@@ -105,7 +105,6 @@ def get_or_create_node(node_id, slotcount, slotidx):
105105 break
106106
107107 # Calculate total slot counts for edges
108- # total_slot_count_from_nodes = sum(n["SlotCount"] for n in G.nodes().values())
109108 total_slot_count_from_edges = sum (e ["SlotCount" ] for e in G .edges ().values ())
110109
111110 # Add attributes to nodes and edges for DOT output
@@ -147,20 +146,3 @@ def get_or_create_node(node_id, slotcount, slotidx):
147146out_filename_without_ext = splitext (sys .argv [1 ])[0 ]
148147write_dot (G , out_filename_without_ext + ".dot" )
149148nx .nx_agraph .to_agraph (G ).draw (path = out_filename_without_ext + ".svg" , prog = 'dot' ,format = 'svg' )
150-
151- # print all simple paths in the graph
152- paths = []
153- for source in G .nodes :
154- for target in G .nodes :
155- if source != target :
156- for path in nx .all_simple_paths (G , source = source , target = target ):
157- # get the total weight of the path and print it
158- # print(" -> ".join(path) + f" SlotCount: {nx.path_weight(G, path, weight='SlotCount')}")
159- # append the path, and it's length to a list
160- paths .append ((path , nx .path_weight (G , path , weight = 'SlotCount' )))
161-
162- # sort the paths by length, descending, and print the top 2
163- paths .sort (key = lambda x : x [1 ], reverse = True )
164- print ("\n Top 2 longest paths:" )
165- for path , length in paths [:2 ]:
166- print (" -> " .join (path ) + f" Length: { length } " )
0 commit comments