Checking whether there exist an edge between two nodes

54 views
Skip to first unread message

vb vignesh

unread,
Feb 26, 2015, 12:49:59 PM2/26/15
to spar...@googlegroups.com
How to check whether there exist an edge between two given nodes

Ex: hello--5-->world

given "hello" and "world" I've to find whether there is an edge,if there is one i want to retrieve the corresponding edge attribute

c3po.ac

unread,
Feb 27, 2015, 8:21:54 AM2/27/15
to spar...@googlegroups.com
Hi,

You can find a step by step tutorial for a similar hello world example here:
http://www.sparsity-technologies.com/StartingGuide/Index.html

The FindObject method can be used to find the nodes if the strings "hello" and "world" are unique ids:
http://www.sparsity-technologies.com/downloads/javadoc-java/html/com/sparsity/sparksee/gdb/Graph.html#findObject(int,%20com.sparsity.sparksee.gdb.Value)

Or you could use Select to find the nodes if you may want to find several nodes with the "hello" or "world" value when the string is not unique.
http://www.sparsity-technologies.com/downloads/javadoc-java/html/com/sparsity/sparksee/gdb/Graph.html#select(int,%20com.sparsity.sparksee.gdb.Condition,%20com.sparsity.sparksee.gdb.Value)

Once you have the two specific nodes that you wanted, you can use FindEdge to get a single edge of a specific type that connects the two nodes (if it exists) when you know that there is only one edge (or you only want one of the possibly several edges of this type connecting this two nodes).
http://www.sparsity-technologies.com/downloads/javadoc-java/html/com/sparsity/sparksee/gdb/Graph.html#findEdge(int,%20long,%20long)

You can also use Edges to get all the edges of a specific type connecting the two nodes.
http://www.sparsity-technologies.com/downloads/javadoc-java/html/com/sparsity/sparksee/gdb/Graph.html#edges(int,%20long,%20long)

Best regards.

El dijous, 26 febrer de 2015 18:49:59 UTC+1, vikiyouvb va escriure:
Reply all
Reply to author
Forward
0 new messages