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

Class nodedict

pattern/graph/__init__.py:292–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290# Return value of Graph.shortest_paths().
291# Dictionary values can be accessed by Node as well as by node id.
292class nodedict(dict):
293 def __init__(self, graph, *args, **kwargs):
294 dict.__init__(self, *args, **kwargs)
295 self.graph = graph
296 def __contains__(self, node):
297 return dict.__contains__(self, self.graph.get(node, node))
298 def __getitem__(self, node):
299 return dict.__getitem__(self, isinstance(node, Node) and node or self.graph[node])
300 def get(self, node, default=None):
301 return dict.get(self, self.graph.get(node, node), default)
302
303def unique(iterable):
304 """ Returns a list copy in which each item occurs only once (in-order).

Callers 3

shortest_pathsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…