Returns a dictionary of nodes, each linked to a list of nodes (shortest path).
(self, node, heuristic=None, directed=False)
| 442 | return None |
| 443 | |
| 444 | def shortest_paths(self, node, heuristic=None, directed=False): |
| 445 | """ Returns a dictionary of nodes, each linked to a list of nodes (shortest path). |
| 446 | """ |
| 447 | if not isinstance(node, Node): |
| 448 | node = self[node] |
| 449 | p = nodedict(self) |
| 450 | for id, path in dijkstra_shortest_paths(self, node.id, heuristic, directed).iteritems(): |
| 451 | p[self[id]] = path and [self[id] for id in path] or None |
| 452 | return p |
| 453 | |
| 454 | def eigenvector_centrality(self, normalized=True, reversed=True, rating={}, iterations=100, tolerance=0.0001): |
| 455 | """ Calculates eigenvector centrality and returns a node => weight dictionary. |