MHB Does Max-Kruskal Algorithm Find the Maximum Spanning Tree?

  • Thread starter Thread starter evinda
  • Start date Start date
  • Tags Tags
    Algorithm
AI Thread Summary
The discussion focuses on an algorithm to find the Maximum Spanning Tree (MST) of a graph using a modified version of Kruskal's algorithm. The proposed algorithm, named Max-KRUSKAL, sorts the edges in decreasing order by weight and constructs the MST by adding edges while ensuring no cycles are formed. To prove that Max-KRUSKAL produces a valid spanning tree, it is necessary to demonstrate two key properties: Spanning Tree Validity and Maximality. Spanning Tree Validity can be established by showing that the algorithm connects all vertices without forming cycles, as it utilizes the union-find structure to manage connected components. Maximality can be proven by arguing that if any edge were to be added that is not included in the resulting tree, it would have a lower weight than the edges already included, contradicting the assumption of maximality. The discussion seeks hints on how to formally prove these properties, indicating a need for a structured approach to validation.
evinda
Gold Member
MHB
Messages
3,741
Reaction score
0
Hello! (Wave)

Give an algorithm that finds the MST (maximum spanning tree) of a graph $G=(V,E)$.
Prove that the algorithm you gave finds the MST.

I tried the following:

I applied the Kruskal algorithm, but instead of ordering the edges by weights in increasing order I ordered them in decreasing order.

Code:
    Max-KRUSKAL(G,w)
    1. A={}
    2. for each vertex v∈ G.V
    3.      MAKE-SET(v)
    4. sort the edges of G.E into decreasing order by weight w
    5. for each edge (u,v) ∈ G.E, taken in decreasing order by weight w
    6.      if FIND-SET(u)!=FIND-SET(v)   
    7.         A=A U {(u,v)}  
    8.         Union(u,v)
    9. return A
To prove that this algorithm finds indeed the MST, we have to prove that the algorithm produces a spanning tree and that the constructed spanning tree is of maximal weight. But could you give me a hint how we could prove the properties Spanning Tree Validity and Maximality ?
 
Technology news on Phys.org
Or do we suppose that the algorithm does not give the maximum spanning tree, in order to get a contradiction?
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
I am trying to run an .ipynb file and have installed Miniconda as well as created an environment as such -conda create -n <env_name> python=3.7 ipykernel jupyter I am assuming this is successful as I can activate this environment via the anaconda prompt and following command -conda activate <env_name> Then I downloaded and installed VS code and I am trying to edit an .ipynb file. I want to select a kernel, via VS Code but when I press the button on the upper right corner I am greeted...

Similar threads

Replies
3
Views
2K
Replies
22
Views
5K
Replies
8
Views
2K
Replies
22
Views
2K
Replies
7
Views
2K
Back
Top