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)
| 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): |