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

Function edges

pattern/graph/__init__.py:743–749  ·  view source on GitHub ↗

Returns an iterator of Edge objects for the given list of nodes. It yields None where two successive nodes are not connected.

(path)

Source from the content-addressed store, hash-verified

741 return _root and sorted(p, key=len) or p
742
743def edges(path):
744 """ Returns an iterator of Edge objects for the given list of nodes.
745 It yields None where two successive nodes are not connected.
746 """
747 # For example, the distance (i.e., edge weight sum) of a path:
748 # sum(e.weight for e in edges(path))
749 return len(path) > 1 and (n.links.edge(path[i+1]) for i,n in enumerate(path[:-1])) or iter(())
750
751#--- GRAPH THEORY ----------------------------------------------------------------------------------
752

Callers

nothing calls this directly

Calls 2

lenFunction · 0.85
edgeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…