So you have:
n n1
| \ ^
| \ |
| ---n2 n3
v /
n4 --/
And want to find paths of depth two (outgoing relationships), which are:
n -- n2 -- n3
n -- n2 -- n4
And for each of those paths see if there are any shorter path(s) (in
Hi Jeff,
What you are describing is a Friends-of-a-friend (foaf) traversal, which
are the friends of my friends, who are not my direct friends.
The best way to perform such a traversal is by using the traversal API:
n.traverse( Order.BREADTH_FIRST, // because we want to exclude the direct
Suppose I have the following node/paths
n - n1
n - n2
n - n4
n2 - n1
n2 - n3
n2 - n4
I want to find all paths of depth two (for example):
n - n2 - n3
n - n2 - n4
and filter out those paths where a shorter path exists to a given node
(n) leaving just
n - n2 - n3
since n - n4 is shallower
3 matches
Mail list logo