开发者

union find sorted list of min edge

I have a union find data structure for connected components in my graph, but need to be able to find a minimum edge in a component quickly. Right now I'm keeping a sorted list o开发者_开发知识库f edges for each component, but this makes the union of two components slow. Any suggestions for a better approach than keeping a sorted list for components?


Maybe there are more requirements than you note in your question, but if you just need the minimum edge, why not just keep track of the minimum edge for each component rather than a complete sorted list of edges for each component?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜