Algorithm to find MST in a weighted acyclic directed graph

algorithmsgraph theory

The question is

Given an algorithm whose input is graph G(V,E)

Where G has the following properties:

  • *G is directed graph

  • G is a weighted graph

  • G is acyclic

  • G contains a directed spanning tree

The algorithm returns a directed minimal spanning tree.

The algorithm suggests that for every vertex $v\in V$ in G where $deg_{in}(v)>0$ remove all incoming edges except the lightest one.

Prove the algorithms validity.

I noticed a few properties about the new graph that will probably is part of the proof but i am not sure how to put the pieces together.

Best Answer

We have to prove two things: (1) the algorithm gives us a valid spanning tree. (2) the resulting sum of edgecosts is minimal over all possible spanning trees.

Let $T$ be the collection of edges returned by the algorithm:

For (1): It is clear that the algorithm returns exactly $n-1$ edges where $n$ is the number of nodes. Now let $T_u$ be the undirected set of edges arising from $T$. Then $(V, T_u)$ cannot contain any cycles because of the following argument: Assume there is a cycle in $(V, T_u)$. Then there exist nodes $u, v$ such that there are two $u$-$v$-paths in $T$. But this would mean that $deg_T(v) > 1$ which is not possible given the definition of the algorithm. Since we have $n-1$ edges on $n$ nodes with no cycles it follows that $T_u$ is a spanning tree of $G$.

For (2): Note that this does not hold. I give a counterexample: Let $$V = \{A, B, C, D\}$$ $$E = \{ (A, B), (A, C), (B, D), (C, D)\}$$ $$c((A, B)) = 10, c((A, C)) = 10, c((B, D)) = 1, c((C, D)) = 1$$

The minimum spanning tree is given by either $T = \{ (A, B), (B, D), (C, D)\}$ or $T = \{ (A, C), (B, D), (C, D)\}$. But neither of those can be returned by your algorithm because the in-degree of $D$ is $2$ in both cases.

Related Question