Returns a list of nodes sorted by WEIGHT or CENTRALITY. Nodes with a lot of traffic will be at the start of the list.
(self, order=WEIGHT, threshold=0.0)
| 474 | return bc |
| 475 | |
| 476 | def sorted(self, order=WEIGHT, threshold=0.0): |
| 477 | """ Returns a list of nodes sorted by WEIGHT or CENTRALITY. |
| 478 | Nodes with a lot of traffic will be at the start of the list. |
| 479 | """ |
| 480 | o = lambda node: getattr(node, order) |
| 481 | nodes = ((o(n), n) for n in self.nodes if o(n) >= threshold) |
| 482 | nodes = reversed(sorted(nodes)) |
| 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. |
no outgoing calls