Query regarding the Neighbours method (distinct results)

32 views
Skip to first unread message

Aethelred

unread,
Jun 4, 2014, 7:51:33 AM6/4/14
to spar...@googlegroups.com
Hi

In the course of generating a graph from some tabular  data, I wrote some diagnostics tools to check that I was not duplicating edges of type P between vertices X and Y.

The output for g.Degree(nodeID, edgeType-P, EdgesDirection.Ingoing) is 65

However, the number of neighbouring nodes returned from g.Degree(nodeID, edgeType-P, EdgesDirection.Ingoing) is 50.

The API reference is not very clear or detailed on this point: is it the case that the Neighbours method returns *distinct* results (i.e. where duplicate neighbour nodes have been removed)?

Thanks and kind regards
Petra

Aethelred

unread,
Jun 4, 2014, 7:54:34 AM6/4/14
to spar...@googlegroups.com
Sorry, I noticed a typo on my part: the second method call is 

g.Neighbours(nodeID, edgeType-P, EdgesDirection.Ingoing), 

and not 

g.Degree(nodeID, edgeType-P, EdgesDirection.Ingoing).

Thanks,
Petra

c3po.ac

unread,
Jun 4, 2014, 9:07:30 AM6/4/14
to spar...@googlegroups.com

Hi,

Yes. The Neighbors result is an Objects instance.
The Objects class is a set of identifiers (from nodes or edges), so it can't have order or duplicates.

You can use explode instead of neighbors to get the edges and then iterate the edges to get each neighbor (including duplicates).

Best regards.


El dimecres 4 de juny de 2014 13:54:34 UTC+2, Aethelred va escriure:
Reply all
Reply to author
Forward
0 new messages