3 ms·
I'm thinking about how I'd implement CHM. I think I'd use a union-find data structure to generate the acyclic graph, as in Kruskal's algorithm. This would fit i
by mtdewcmu 11y ago
I'm thinking about how I'd implement CHM. I think I'd use a union-find data structure to generate the acyclic graph, as in Kruskal's algorithm. This would fit into an N-element integer vector. After finding the acyclic graph (forest), I'd represent the forest implicitly in another N-element integer vector, for finding the vertex weights.
You can take advantage of the graph being just a forest of trees and use simpler data structures.