answersLogoWhite

0


Best Answer

Prims Algorithm is used when the given graph is dense , whereas Kruskals is used when the given is sparse,we consider this because of their time complexities even though both of them perform the same function of finding minimum spanning tree.

ismailahmed syed

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you use prim's algorithm to find a spanning tree of a connected graph with no weight on its edges?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is krushkal algorithm?

Kruskal's algorithm is an algorithm in graph theory that finds a minimum spanning tree for a connected weighted graph. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized. If the graph is not connected, then it finds a minimum spanning forest (a minimum spanning tree for each connected component). Kruskal's algorithm is an example of a greedy algorithm.


What is the complexity of kruskal's minimum spanning tree algorithm on a graph with n nodes and e edges?

o(eloge)


Why prims algorithm is better than kruskals algorithm?

"What are difference between Prim's algorithm and Kruskal's algorithm for finding the minimum spanning tree of a graph?" Prim's method starts with one vertex of a graph as your tree, and adds the smallest edge that grows your tree by one more vertex. Kruskal starts with all of the vertices of a graph as a forest, and adds the smallest edge that joins two trees in the forest. Prim's method is better when * You can only concentrate on one tree at a time * You can concentrate on only a few edges at a time Kruskal's method is better when * You can look at all of the edges at once * You can hold all of the vertices at once * You can hold a forest, not just one tree Basically, Kruskal's method is more time-saving (you can order the edges by weight and burn through them fast), while Prim's method is more space-saving (you only hold one tree, and only look at edges that connect to vertices in your tree).


When prim algorithm fail?

When there are directed edges in the graph, as it is impossible to move back from B to A when the edges are directed.


Will either kruskal or prim's algorithm work on negative edge graph?

The correctness of either Prim's or Kruskal's algorithm, is not affected by negative edges in the graph. They both work fine with negative edges. The question boils down to "Does a Priority Queue of numbers work with negative numbers?" because of the fact that both Prim's and Kruskal's algorithm use a priority queue. Of course -- as negative numbers are simply numbers smaller than 0. The "<" sign will still work with negative numbers.

Related questions

What is krushkal algorithm?

Kruskal's algorithm is an algorithm in graph theory that finds a minimum spanning tree for a connected weighted graph. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized. If the graph is not connected, then it finds a minimum spanning forest (a minimum spanning tree for each connected component). Kruskal's algorithm is an example of a greedy algorithm.


What is the complexity of kruskal's minimum spanning tree algorithm on a graph with n nodes and e edges?

o(eloge)


Prove that a graph G is connected if and only if it has a spanning tree?

Proving this is simple. First, you prove that G has a spanning tree, it is connected, which is pretty obvious - a spanning tree itself is already a connected graph on the vertex set V(G), thus G which contains it as a spanning sub graph is obviously also connected. Second, you prove that if G is connected, it has a spanning tree. If G is a tree itself, then it must "contain" a spanning tree. If G is connected and not a tree, then it must have at least one cycle. I don't know if you know this or not, but there is a theorem stating that an edge is a cut-edge if and only if it is on no cycle (a cut-edge is an edge such that if you take it out, the graph becomes disconnected). Thus, you can just keep taking out edges from cycles in G until all that is left are cut-gees. Since you did not take out any cut-edges, the graph is still connected; since all that is left are cut-edges, there are no cycles. A connected graph with no cycles is a tree. Thus, G contains a spanning tree. Therefore, a graph G is connected if and only if it has a spanning tree!


Prove that a graph G is connected and only if it has a spanning tree?

Proving this is simple. First, you prove that G has a spanning tree, it is connected, which is pretty obvious - a spanning tree itself is already a connected graph on the vertex set V(G), thus G which contains it as a spanning sub graph is obviously also connected. Second, you prove that if G is connected, it has a spanning tree. If G is a tree itself, then it must "contain" a spanning tree. If G is connected and not a tree, then it must have at least one cycle. I don't know if you know this or not, but there is a theorem stating that an edge is a cut-edge if and only if it is on no cycle (a cut-edge is an edge such that if you take it out, the graph becomes disconnected). Thus, you can just keep taking out edges from cycles in G until all that is left are cut-gees. Since you did not take out any cut-edges, the graph is still connected; since all that is left are cut-edges, there are no cycles. A connected graph with no cycles is a tree. Thus, G contains a spanning tree. Therefore, a graph G is connected if and only if it has a spanning tree!


Why prims algorithm is better than kruskals algorithm?

"What are difference between Prim's algorithm and Kruskal's algorithm for finding the minimum spanning tree of a graph?" Prim's method starts with one vertex of a graph as your tree, and adds the smallest edge that grows your tree by one more vertex. Kruskal starts with all of the vertices of a graph as a forest, and adds the smallest edge that joins two trees in the forest. Prim's method is better when * You can only concentrate on one tree at a time * You can concentrate on only a few edges at a time Kruskal's method is better when * You can look at all of the edges at once * You can hold all of the vertices at once * You can hold a forest, not just one tree Basically, Kruskal's method is more time-saving (you can order the edges by weight and burn through them fast), while Prim's method is more space-saving (you only hold one tree, and only look at edges that connect to vertices in your tree).


When prim algorithm fail?

When there are directed edges in the graph, as it is impossible to move back from B to A when the edges are directed.


Define walk path and connected graph in an algorithm?

A "walk" is a sequence of alternating vertices and edges, starting with a vertex and ending with a vertex with any number of revisiting vertices and retracing of edges. If a walk has the restriction of no repetition of vertices and no edge is retraced it is called a "path". If there is a walk to every vertex from any other vertex of the graph then it is called a "connected" graph.


How many faces edges and vertices do connected pyramid have?

A Connected Pyramids have 10 Faces, 12 Vertices, 20 Edges.


What does micheele kwan means by put some real weight into her edges?

She means that you have to put weight into the "edges" so that she can skate fluently.


Is faces plus corners equals edges?

No. Faces + Vertices = Edges + 2 (The Euler characteristic of simply connected polyhedra).


How many corner does a triangular pyramid have?

A triangular pyramid has 4 vertices (each vertex has 3 edges connected to it).


What solid figure has 4 faces 9 edges and 6 vertices?

It is not any kind of simply connected solid figure because it does not satisfy the Euler characteristic which requires thatFaces + Vertices = Edges + 2It is not any kind of simply connected solid figure because it does not satisfy the Euler characteristic which requires thatFaces + Vertices = Edges + 2It is not any kind of simply connected solid figure because it does not satisfy the Euler characteristic which requires thatFaces + Vertices = Edges + 2It is not any kind of simply connected solid figure because it does not satisfy the Euler characteristic which requires thatFaces + Vertices = Edges + 2