Index: mininet_testing/topo_eval.py |
diff --git a/mininet_testing/topo_eval.py b/mininet_testing/topo_eval.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7934a159ec88408baf4b49151aecb40a0991d8da |
--- /dev/null |
+++ b/mininet_testing/topo_eval.py |
@@ -0,0 +1,33 @@ |
+import json |
+ |
+ |
+# https://www.python.org/doc/essays/graphs/ |
+def _find_all_paths(neighbors, start, end, path=[]): |
+ path = path + [start] |
+ if start == end: |
+ return [path] |
+ if start not in neighbors.keys(): |
+ return [] |
+ paths = [] |
+ for node in neighbors[start]: |
+ if node not in path: |
+ newpaths = _find_all_paths(neighbors, node, end, path) |
+ for newpath in newpaths: |
+ paths.append(newpath) |
+ return paths |
+ |
+ |
+f = open('topo_neighbors.txt.1', 'r') |
+topo_json = f.read() |
+topo_dict = json.loads(topo_json) |
+f.close() |
+topo = {} |
+ |
+# topo_dict has strings as keys. Changing to int |
+for key, value in topo_dict.items(): |
+ topo[int(key)] = value |
+ |
+# print topo_dict |
+# print topo |
+ |
+print _find_all_paths(topo, 303, 313) |