gonum / graph

Graph packages for the Go language [DEPRECATED]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

topo: replace ConnectedComponents implementation with union-find

kortschak opened this issue · comments

We can do better with the performance of this function.

I copied path/disjoint.go to topo/. Modified it to store the node in the disjointSetNode struct. Then I implemented func (ds *disjointSet) connectedComponents() [][]graph.Node and used it to implement ConnectedComponents in topo.go. I ran benchmarks on the original implementation and the union-find implementation and the union-find was slower. Are you interested in seeing the code, or have you any further suggestions? No rush. See to it, if you choose to, at your leisure. Thanks.

Closed after investigation in #190.