AllPaths
Selects every matching path. Built by PathPattern.all.
Methods
.paths()
AllPaths.paths() -> DerivedColumnReturn one PathTraversal per matching path.
Enumeration uses walk semantics: nodes and edges may repeat, so cycles in the graph can result in arbitrarily many paths.
Returns:
DerivedColumn-PathTraversalvalues, one per matching path. Use it as a relation insideModel.where/Model.select, and read the per-path details (length,nodes,relationships,relationship_fields) via thePathTraversalproperties.
Examples:
p = m.path(Person.follows.repeat(1, 3)).where(Person.name == "Alice").all().paths()m.where(p).select( p, p.length, p.nodes["index"], Person(p.nodes).name.alias("node")).inspect()# p length index node# 0 6w6baylbPzQBFBq7X+77Ug 1 0 Alice# 1 6w6baylbPzQBFBq7X+77Ug 1 1 Bob# 2 IBUHvCZTYTKnBRjIey8suw 2 0 Alice# 3 IBUHvCZTYTKnBRjIey8suw 2 1 Bob# 4 IBUHvCZTYTKnBRjIey8suw 2 2 DavidEach distinct p value identifies one path; rows sharing a p describe the
nodes visited along it.
Notes:
Only the path’s endpoint identifiers unify with the enclosing scope. Filters on
interior nodes must be attached with PathPattern.where on the pattern;
a filter referencing interior nodes placed in an enclosing
Model.where cannot be routed into the path and
raises.
Performance: Enumerating all paths is worst-case exponential in the size of the
graph and thus may be EXTREMELY EXPENSIVE! Try to make your path pattern as
selective as possible, and run on smaller test data when building your model and
query for path count first. Confirm that your graph is acyclic via Graph.is_acyclic.
Unless you need variable repeats or enumeration of nodes and edges along the path,
consider using regular PyRel to express your query instead of .all().paths().
If you only need to know whether or which endpoints are connected — not
the paths themselves — use PathPattern.exists, which runs in polynomial time.