diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2009-11-23 14:45:11 +0100 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2009-11-23 14:45:11 +0100 |
commit | 57b10e1b76dd3bd3c834bacd338076de6e35cabe (patch) | |
tree | 3f59f0a76e5bcb0bd760b37edac7b2fe906a2473 /graph.py | |
parent | b7e84e3fc5418641041f95a80f08fe053c004c27 (diff) | |
parent | 1b4d12cbd2ab6e6e586743df592648faa42fa26e (diff) | |
download | logilab-common-57b10e1b76dd3bd3c834bacd338076de6e35cabe.tar.gz |
Diffstat (limited to 'graph.py')
-rw-r--r-- | graph.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -189,16 +189,16 @@ def has_path(graph_dict, fromnode, tonode, path=None): node has key associated to a list of nodes directly reachable from it. Return None if no path exists to go from `fromnode` to `tonode`, else the - first path found + first path found (as a list including the destination node at last) """ if path is None: path = [] elif fromnode in path: - return False + return None path.append(fromnode) for destnode in graph_dict[fromnode]: if destnode == tonode or has_path(graph_dict, destnode, tonode, path): - return path[1:] + return path[1:] + [tonode] path.pop() return None |