Borůvka's algorithm: Difference between revisions

Content deleted Content added
Pseudocode: explain necessity of tie-breaking (after removing requirement of distinct edge weights)
Pseudocode: fix vertex names
Line 46:
If edges do not have distinct weights, then a consistent '''tie-breaking rule''' must be used, e.g. based on some [[total order]] on vertices or edges.
This can be achieved by representing vertices as integers and comparing them directly; comparing their [[memory address]]es; etc.
A tie-breaking rule is necessary to ensure that the created graph is indeed a forest, that is, it does not contain cycles. For example, consider a triangle graph with nodes {''ua'',''vb'',''wc''} and all edges of weight 1. Then a cycle could be created if we select ''ab'' as the minimal weight edge for {''a''}, ''bc'' for {''b''}, and ''ca'' for {''c''}.
 
'''algorithm''' Borůvka '''is'''