0
$\begingroup$

Something I was asked to solve and tried to come up with a formula or some method to solve it after I did and couldn't.

  • Given is a graph G=(V,E) that is undirected and weighted. Say we want to find the lightest paths tree (assume using Dijkstra's algorithm), we will call it K, and the Minimal Spanning Tree (assume using Kruskal's or Prim's algorithm) that we will call T. How can we ensure that the total weight of K is 10 times that of T if we run the algorithm on the same source node 's'? Important note: we cannot use negative weights on the edges.

The only way I managed to do this is by drawing and testing a bunch of graphs until I found something that works. It seems if we build a "ferris wheel" graph, and make the inside edges heavy and the outer edges light, we can manage getting a 10 times heavier lightest paths tree.

This definition of a "ferris wheel" graph is not formal - a node that is surrounded by more nodes and each node has an edge to the 'middle' node, and each surrounding node has an edge to the node next to it, forming something that resembles a ferris wheel)

$\endgroup$
3
  • $\begingroup$ Are you looking for a weighted graph $G$ such that the total weight of the edges selected by some SPT of $G$ (from some source vertex $s$) is exactly 10 times the weight of a MST of $G$? If so, any connected graph where all edges have weight $0$ will do. $\endgroup$
    – Steven
    Commented Feb 12 at 23:45
  • 1
    $\begingroup$ It is unclear what you are trying to do: what is the input of your problem and what is the wanted output? As stated, you graph is part of the input, so you can just check if the condition is verified or not and output true or false (but I think that's not what you want). $\endgroup$
    – Nathaniel
    Commented Feb 13 at 0:05
  • $\begingroup$ You are absolutely right, I was unclear about what the "output" should be. I am simply looking for more examples of such graph/s and maybe try to find a pattern for solution and come up with a formula/algorithm for this - which should return True/False if the condition holds. And yes, I am looking for some weighted graph G that is described exactly like what you wrote. I think the case where the weight is 0 means the graph is not weighted though? Assume w(e) for every e_i in E > 0 $\endgroup$
    – Eddie
    Commented Feb 13 at 14:13

1 Answer 1

0
$\begingroup$

Consider a graph $G = (V, E, w)$ such that:

  • $V = \{s\}\cup \{v_1, …, v_n\}$;
  • $E = E_1 \cup E_2$, with:
    • $E_1 = \{\{s, v_i\}\mid i\in \{1, …, n\}\}$, $f(s, v_i) = n + 1$
    • $E_2 = \{\{v_i, v_{i+1}\}\mid i \in \{1, …, n\}\}$, $f(v_i, v_{i+1}) = 1$ (with the convention that $v_{n+1} = v_1$).

Then the shortest path tree from $s$ will be $(V, E_1)$, of weight $n(n+1)$, and a MST will be all edges from $E_2$ but one, and one edge from $E_1$, of weight $(n-1) + n + 1 = 2n$. That means that there is a factor $\frac{n+1}2$ between the weight of the SPT and the MST. If you choose $n = 19$, you will get what you want.

You can repeat the process by adding other "layers" to the graph, with heavy radial edges and light transversal edges.

I don't know if that was what you described as a ferris wheel, but hey, at least I added a formal definition. (Then again, what you are asking is unclear)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.