Skip to content

Commit

Permalink
Added deep rerooting while finding cheapest tree
Browse files Browse the repository at this point in the history
  • Loading branch information
ipgmvq authored Apr 3, 2023
1 parent 17394d4 commit 18e5c11
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nodeweightedbudget/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def find_short_path(graph, adj_matrix, depth, previous, current):
elif graph.vertices[i].distance > distance:
graph.vertices[i].distance = distance
graph.vertices[i].parent = current
graph.find_short_path(
adj_matrix=adj_matrix, depth=depth+1, previous=current, current=i)
for i, v in graph.vertices.items():
if v.parent is not None:
graph.vertices[v.parent].children.add(i)
Expand Down

0 comments on commit 18e5c11

Please sign in to comment.