Kruskal template

whitehousechef·2023년 12월 8일

very well explained here
https://techblog-history-younghunjo1.tistory.com/262

Since Kruskal needs to sort on the number of edges, choose Kruskal when there are just a few edges and choose Prim when there are many edges.

Kruskal works for negative weights like Prim so choose based on the sparsity of the graph.

0개의 댓글