Hi,

I have a large graph and I am trying to extract the list of edges that
correspond to some relationship "foo", node A -> node B.
I cannot figure out how to do this. I have tried using a traversal
class, but I am not having any luck.

neo = NeoService("the path")

class Follow(neo4j.Traversal):
    types = [
        neo4j.Outgoing.follows
    ]
    order = neo4j.DEPTH_FIRST
    stop = neo4j.STOP_AT_END_OF_GRAPH
    def isReturnable(self, position):
        return (not position.is_start
                and position.last_relationship.type == 'follows')


for friend_node in Friends(node):
     ...

but this seems to only get the other end of the relationship, not both
ends. If I wrap this in a for loop "for node in neo.node" I get a huge
number of nodes, way more than are in the graph.

Even if I write an isStopNode function to mimick STOP_AT_DEPTH_ONE,
the script keeps going and I end up with millions of nodes in the
edgelist, when there are only 1000.

TIA,
Ryan
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to