Find a minimum weighted spanning tree of the Cycle graph - algorithm

I'm trying to solve the problem presented above and here is my attempt:
Attempt: We can apply Dijkstra's shortest path algorithm instead of using Prim's and Kruskal's algorithms to find a MST as Dijkstra will visit all the nodes in the smallest weighted distance. Complexity: For G = (V,E), O(E log(V))
Questions:
(1) Is my approach correct ?
(2) Is it the most efficient answer to the question ?
If i'm completely wrong, I would appreciate a correct and efficient solution.

A cycle graph contains no edges other than those connecting the vertices in the cycle. So what we can do is iterate through all N edges and eliminate the maximum weighted edge forming a spanning tree of N - 1 edges containing the minimum sum of edges, forming a Minimum Spanning Tree.

Related

Minimum Weighted Path Tree of an Undirected Graph

Assume that we have an undirected graph G=(V,E) and we have two nodes S and X.
Can we come up with an algorithm such that the largest weight of the edge on the path from S to X is minimized? Note that it is not the shortest path algorithm since we are not interested in minimizing their sum.
What is the complexity of this algorithm?
Is the minimum spanning tree algorithm (such as Prim) is a solution for the problem?
I don't know if minimum spanning tree will solve it or not, but it's certainly solvable by making some modifications to Dijkstra's algorithm.
Define the "length" of a path as the maximum edge in that path. Now find the shortest path from S to X using Dijkstra's algorithm. This is the path you are looking for.
Complexity is O((N+M)log N) if you use a binary heap and O(N * log N + M) with a Fibonacci heap.
Note that for this new definition of path length, if the length of a path is l, then adding an edge to the end of the path will not decrease it's length, since the maximum edge in that path can only increase. This property is necessary for Dijkstra's algorithm to work correctly.
For instance, if you were looking for the path with the shortest edge, then Dijkstra's algorithm will fail just like it fails when there are negative edges in the graph.
You can use minimum spanning tree (Prim's algorithm) to solve this problem. You will start with vertex S, then continue to build the tree using Prim's algorithm until you find X. Complexity will be O((V+E)*logV).
It will work because in the prim's algorithm you always choose the edge with minimum weight first.

Finding maximal spanning tree using Prim's algorithm

Can we compute the maximal spanning tree by changing the algorithm to choosing the maximum vertex instead of choosing the minimum one?
I have come across the solution by negating the edges and applying the normal Prim's Minimum Spanning Tree algorithm.
Feed in to the algorithm the input graph, but with the weights negated. Nothing in Prim assumes the weights are positive. The minimum of the weights negated, is achieved by the maximum of the original weights.

Find cheapest cycle in an undirected weighted graph

I'm stuck on searching an algorithm to find the cheapest cycle in a weighted undirected graph in O(n^2). The cycle does not have to visit every vertex in the graph (i.e. I'm not looking for a Hamiltonian cycle).
Can someone help me finding a strategy?
an example of weighted undirected graph:
I'm not sure where the O(n^2) time bound came from. The obvious O(n (m + n log n))-time algorithm is, for each vertex, to compute a shortest-path tree from that vertex and then consider the fundamental cycle made by a non-tree edge and some tree edges.

Finding spanning tree with maximum minimum degree

Given a connected undirected graph, the problem of finding the spanning tree with the minimum max degree has been well-studied (M. F¨urer, B. Raghvachari, "Approximating the minimum degree spanning tree to within one from the optimal degree", ACM-SIAM Symposium on Discrete Algorithms (SODA), 1992). The problem is NP-hard and an approximation algorithm has been described in the reference.
I am interested in the following problem - given a connected undirected graph G = (V1,V2,E), find the spanning tree with the maximum min degree over all internal nodes (non-leaf nodes). Can someone please tell me if this problem has been studied; is it NP-hard or does there exist a polynomial-time algorithm for solving it? Also, the graph can be considered to be bipartite for convenience.
As noted in Evgeny Kluev's comment, the leaves of a (finite) tree have degree 1. (Else, cycles would exist and the structure would not be a tree.)
If instead you mean to find a spanning tree with a node of maximum degree, from among all possible spanning trees on a connected undirected graph G, then just form a spanning tree whose root R is a node M of G with maximal degree among all the nodes of G, and all neighbors of M are children of R.
It looks like exact cover by 3-sets can be reduced to this problem. Represent the 3-sets by vertices of degree 4, each with 3 edges connecting it to 3 nodes representing its elements in the original problem instance. The additional 4th edge connects all the "3-set" nodes to a single vertex V.
This graph is biparite - every edge is between a "3-set" node and an "element" node (or V). Now this graph has a spanning tree of max min degree = 4 if and only if the original problem has a solution.
Obviously there need to be enough of the 3-sets so that the node V doesn't lower the max min degree of the tree, but this limit doesn't change the NP-hardness of the problem.

Graph algorithms: Prim

I was wondering if any minimum spanning tree of a graph G can be provided by an execution of the algorithm Prim on this graph?
Does the Prim algorithm give us all the possible MST?
I was wondering if any minimum spanning tree of a graph G can be
provided by an execution of the algorithm Prim on this graph?
Yes.
Prim's algorithm is known to be a good algorithm to find a minimum
spanning tree.
Since Prim's algorithm constructs a MST from a weighted, connected, undirected graph, yes, you can use it to get a minimum spanning tree from such a graph. If your graph is not connected it won't work (but neither will any other algorithm because there is no spanning tree, then). If your graph is not weighted it will just create a spanning tree.
If you use Prim's once to get a MST then delete an edge. Then use prim's again to see if you can still get a MST of the same length. If you do, repeat, otherwise put the edge back and remove another edge. It will be slowish ... Perhaps only remove heavy edges?

Resources