Question

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

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top