Вопрос

Like in title. What is the optimal way to keep nodes in memory for Kruskal's algorithm, and why?

Это было полезно?

Решение

Kruskal algorithm is basically dong exactly what the Disjoint set forest structure is meant to do. This structure starts with all nodes being in separate components and then supports operations of the kind

Join nodes A and B

and

Are Nodes A and B in the same cover tree already?

That is exactly why I would tell this is the most suitable representation for the nodes.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top