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?
精彩评论