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

Method prune

pattern/graph/__init__.py:485–489  ·  view source on GitHub ↗

Removes all nodes with less or equal links than depth.

(self, depth=0)

Source from the content-addressed store, hash-verified

483 return [n for w, n in nodes]
484
485 def prune(self, depth=0):
486 """ Removes all nodes with less or equal links than depth.
487 """
488 for n in (n for n in self.nodes if len(n.links) <= depth):
489 self.remove(n)
490
491 def fringe(self, depth=0, traversable=lambda node, edge: True):
492 """ For depth=0, returns the list of leaf nodes (nodes with only one connection).

Callers 1

test_pruneMethod · 0.80

Calls 2

removeMethod · 0.95
lenFunction · 0.85

Tested by 1

test_pruneMethod · 0.64