Skip to content

Conversation

spaden
Copy link

@spaden spaden commented Sep 20, 2019

Prims and Dijkstra's Algorithm heapq change

Add this method to Vertex class, since heapq doesn't support addition of class objects inside typles

def lt(ob1, ob2):
return ob1.getDistance() < ob2.getDistance()

For the Bellman-Ford Algorithm, the for loop is not needed. It just increases the compelxity
#Delete this line
for i in range(len(G) - 1):

Prims and Dijkstra's Algorithm heapq change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant