Hello all,

I have a question regarding traversals over a large graph when that
traversal depends on a discretely valued attribute of the nodes being
traversed.

As a small example, the nodes in my graph can have 2 states -- on and off.
I'd like to traverse over paths that only consist of active nodes. Since
this state attributes can only take 2 values, I see two possible approaches
to implementing this:

1) Use node properties, and have the PruneEvaluator and filter Predicate
check to see whether the current endNode has a property called "on".

2) Create a state node which represents the "on" state. Have all nodes that
are in the on state have a relationship of type "STATE_ON" incoming from the
"on" node. Have the PruneEvaluator and filter Predicate check whether the
node has a single relationship of type STATE_ON, INCOMING.

Which is closer to what we might consider best practices for Neo4j? The
problem I see in implementation 1 is that that traversal has to hit the
property store, which could slow things down. The problem with 2 is that
there can be up to #nodes relationships coming from the on state node, and
making this more efficient by setting up a tree of "on" state nodes seems to
be manually replicating something that the indexing service has already
accomplished.

Also, how efficiently would each of these two implementations exploit
caching (or is this irrelevant?)?

Finally, would your answer change if we generalized this to a larger number
of categories?

Thanks,
Alex
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to