3

Here is the full question:

Assume we have a directed graph G = (V,E), we want to find a graph G' = (V,E') that has the following properties:

  1. G' has same connected components as G
  2. G' has same component graph as G
  3. E' is minimized. That is, E' is as small as possible.

Here is what I got:

First, run the strongly connected components algorithm. Now we have the strongly connected components. Now go to each strong connected component and within that SCC make a simple cycle; that is, a cycle where the only nodes that are repeated are the start/finish nodes. This will minimize the edges within each SCC.

Now, we need to minimize the edges between the SCCs. Alas, I can't think of a way of doing this.

My 2 questions are: (1) Does the algorithm prior to the part about minimizing edges between SCCs sound right? (2) How does one go about minimizing the edges between SCCs.

For (2), I know that this is equivalent to minimizing the number of edges in a DAG. (Think of the SCCs as the vertices). But this doesn't seem to help me.

Frog
  • 311
  • 1
  • 10
user678392
  • 1,981
  • 3
  • 28
  • 50
  • 1
    Sorry for my ignorance: what do you mean with "compnent graph"? I don't understand the difference between 1. and 2. – dingalapadum Apr 12 '15 at 12:02

2 Answers2

1
  1. The algorithm seems right, as long as you allow for closed walks (i.e. repeating vertices.) Proper cycles might not exist (e.g. in an "8" shaped component) and finding them is NP-hard.

  2. It seems that it is sufficient to group the inter-component edges by ordered pairs of components they connect and leave only one edge in each group.

Rafał Dowgird
  • 43,216
  • 11
  • 77
  • 90
  • Between two strongly connected components, there can be arcs only in one direction; so it suffices to consider unordered pairs. – Falk Hüffner Feb 19 '13 at 13:50
  • @FalkHüffner True, but in practice you need to order the pairs anyway in order to produce the canonical representation of an unordered pair :-) – Rafał Dowgird Feb 19 '13 at 14:33
  • @Rafał Dowgird Thanks! But a few questions: (1) what are proper cycles, and (2) I don't understand what your 2 is saying. Are you saying that you are just leaving an edge between each pair of SCCs that are connected in the graph of SCCs? How does this preserve the property: G' has same component graph as G. – user678392 Feb 19 '13 at 17:25
  • @user678392 (1) Proper cycle is a cycle in which no vertex appears twice (2) An edge between components A and B in a component graph exists iff an edge exists between any two vertices from A and B in the original graph. So as long as at least one original edge exists between components, the component graph is preserved. – Rafał Dowgird Feb 19 '13 at 17:54
0

Regarding the step 2,minimize the edges between the SCCs, you could randomly select a vertex, and run DFS, only keeping the longest path for each pair of (root, end), while removing other paths. Store all the vertices searched in a list L.

Choose another vertex, if it exists in L, skip to the next vertex; if not, repeat the procedure above.

Alan Yang
  • 66
  • 5