MCPcopy Index your code
hub / github.com/clips/pattern / paths

Method paths

pattern/graph/__init__.py:421–428  ·  view source on GitHub ↗

Returns a list of paths (shorter than or equal to given length) connecting the two nodes.

(self, node1, node2, length=4, path=[])

Source from the content-addressed store, hash-verified

419 return id1 in self and id2 in self and self[id1].links.edge(id2) or None
420
421 def paths(self, node1, node2, length=4, path=[]):
422 """ Returns a list of paths (shorter than or equal to given length) connecting the two nodes.
423 """
424 if not isinstance(node1, Node):
425 node1 = self[node1]
426 if not isinstance(node2, Node):
427 node2 = self[node2]
428 return [[self[id] for id in p] for p in paths(self, node1.id, node2.id, length, path)]
429
430 def shortest_path(self, node1, node2, heuristic=None, directed=False):
431 """ Returns a list of nodes connecting the two nodes.

Callers 3

graph.jsFile · 0.80
test_pathsMethod · 0.80
test_pathsMethod · 0.80

Calls 1

pathsFunction · 0.85

Tested by 2

test_pathsMethod · 0.64
test_pathsMethod · 0.64