3: Algorithms on graphs Flashcards
(5 cards)
1
Q
What is Kruskal’s?
A
Sort lengths, select smallest, check if forms cycle, if not add it.
2
Q
What is Prim’s?
A
Choose any start vertex, select the smallest arc connected to the tree, repeat.
3
Q
Learn Prim’s for tables!
A
- Choose start vertex.
- Delete the row in the matrix for that one.
- Number the column in the matrix for the chosen vertex.
- Put a ring around the lowest undeleted entry.
- The ringed entry becomes the next arc to be added.
- repeat 2,3,4,5 until all rows have been deleted.
4
Q
What is Dijkstra’s for?
A
Shortest path from A to B!
5
Q
What is Floyd’s for?
A
Shortest path from any vertex to another.