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

Method fringe

pattern/graph/__init__.py:491–496  ·  view source on GitHub ↗

For depth=0, returns the list of leaf nodes (nodes with only one connection). For depth=1, returns the list of leaf nodes and their connected nodes, and so on.

(self, depth=0, traversable=lambda node, edge: True)

Source from the content-addressed store, hash-verified

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).
493 For depth=1, returns the list of leaf nodes and their connected nodes, and so on.
494 """
495 u = []; [u.extend(n.flatten(depth, traversable)) for n in self.nodes if len(n.links) == 1]
496 return unique(u)
497
498 @property
499 def density(self):

Callers 2

taxonomyMethod · 0.80
test_fringeMethod · 0.80

Calls 4

lenFunction · 0.85
uniqueFunction · 0.70
extendMethod · 0.45
flattenMethod · 0.45

Tested by 1

test_fringeMethod · 0.64