Returns a list of paths (shorter than or equal to given length) connecting the two nodes.
(self, node1, node2, length=4, path=[])
| 419 | return id1 in self and id2 in self and self[id1].links.edge(id2) or None |
| 420 | |
| 421 | def paths(self, node1, node2, length=4, path=[]): |
| 422 | """ Returns a list of paths (shorter than or equal to given length) connecting the two nodes. |
| 423 | """ |
| 424 | if not isinstance(node1, Node): |
| 425 | node1 = self[node1] |
| 426 | if not isinstance(node2, Node): |
| 427 | node2 = self[node2] |
| 428 | return [[self[id] for id in p] for p in paths(self, node1.id, node2.id, length, path)] |
| 429 | |
| 430 | def shortest_path(self, node1, node2, heuristic=None, directed=False): |
| 431 | """ Returns a list of nodes connecting the two nodes. |