Skip to content

Commit

Permalink
BUG: Fixed bugs arising from removing Tree namedtuple.
Browse files Browse the repository at this point in the history
  • Loading branch information
henryrobbins committed Feb 7, 2021
1 parent 0095c03 commit 3243cf3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions vinal/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,7 @@ def dijkstras_plot(G:nx.Graph, s:int = 0, **kw) -> GridBox:
GridBox: Plot of Dijkstra's algorithm running on graph G with source s.
"""
nodes, trees, tables = dijkstras(G, s=s, iterations=True)
edges = [tree.edges for tree in trees]
return _graph_iterations_plot(G, nodes=nodes, edges=edges,
return _graph_iterations_plot(G, nodes=nodes, edges=trees,
tables=tables, **kw)


Expand All @@ -725,12 +724,11 @@ def mst_algorithm_plot(G:nx.Graph, algorithm:str, **kw) -> GridBox:
trees = kruskals(G, iterations=True)
elif algorithm == 'reverse_kruskals':
trees = reverse_kruskals(G, iterations=True)
edges = [tree.edges for tree in trees]
nodes = []
for edge in edges:
nodes.append(list(set([item for sublist in edge for item in sublist])))
for tree in trees:
nodes.append(list(set([item for sublist in tree for item in sublist])))
costs = [spanning_tree_cost(G, tree) for tree in trees]
return _graph_iterations_plot(G, nodes=nodes, edges=edges,
return _graph_iterations_plot(G, nodes=nodes, edges=trees,
costs=costs, **kw)


Expand Down

0 comments on commit 3243cf3

Please sign in to comment.