diff options
Diffstat (limited to 'scripts/contrib/graph-tool')
-rwxr-xr-x | scripts/contrib/graph-tool | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/scripts/contrib/graph-tool b/scripts/contrib/graph-tool index 0275fbd5c0..1df5b8c345 100755 --- a/scripts/contrib/graph-tool +++ b/scripts/contrib/graph-tool | |||
@@ -30,8 +30,7 @@ def get_path_networkx(dotfile, fromnode, tonode): | |||
30 | print('ERROR: Please install the networkx python module') | 30 | print('ERROR: Please install the networkx python module') |
31 | sys.exit(1) | 31 | sys.exit(1) |
32 | 32 | ||
33 | graph = networkx.DiGraph(networkx.read_dot(dotfile)) | 33 | graph = networkx.DiGraph(networkx.nx_pydot.read_dot(dotfile)) |
34 | |||
35 | def node_missing(node): | 34 | def node_missing(node): |
36 | import difflib | 35 | import difflib |
37 | close_matches = difflib.get_close_matches(node, graph.nodes(), cutoff=0.7) | 36 | close_matches = difflib.get_close_matches(node, graph.nodes(), cutoff=0.7) |
@@ -53,11 +52,11 @@ def find_paths(args, usage): | |||
53 | 52 | ||
54 | fromnode = args[1] | 53 | fromnode = args[1] |
55 | tonode = args[2] | 54 | tonode = args[2] |
56 | paths = list(get_path_networkx(args[0], fromnode, tonode)) | 55 | |
57 | if paths: | 56 | path = None |
58 | for path in paths: | 57 | for path in get_path_networkx(args[0], fromnode, tonode): |
59 | print(" -> ".join(map(str,path))) | 58 | print(" -> ".join(map(str, path))) |
60 | else: | 59 | if not path: |
61 | print("ERROR: no path from %s to %s in graph" % (fromnode, tonode)) | 60 | print("ERROR: no path from %s to %s in graph" % (fromnode, tonode)) |
62 | sys.exit(1) | 61 | sys.exit(1) |
63 | 62 | ||