snippetModerate
How to remove cycles from a directed graph
Viewed 0 times
graphdirectedremovehowfromcycles
Problem
I saw this from SO which led to Feedback Arc Set, which describes the problem nicely:
In graph theory, a directed graph may contain directed cycles, a one-way loop of edges. In some applications, such cycles are undesirable, and we wish to eliminate them and obtain a directed acyclic graph (DAG).
I am wondering how this is done. Given a graph such as this:
Or a for loop flattened out such as:
Wondering how you can possibly remove the cycles from a graph like that.
In graph theory, a directed graph may contain directed cycles, a one-way loop of edges. In some applications, such cycles are undesirable, and we wish to eliminate them and obtain a directed acyclic graph (DAG).
I am wondering how this is done. Given a graph such as this:
a -> b
b -> c
c -> d
d -> aOr a for loop flattened out such as:
somemethod -> forloop start
forloop start -> forloop next
forloop next -> forloop result
forloop next -> forloop next // i+1
forloop next -> forloop end
forloop end -> forloop result
forloop result -> next methodWondering how you can possibly remove the cycles from a graph like that.
Solution
There is a paper "breaking cycles in noisy hierarchies" which talks about leveraging graph hierarchy to delete cycle edges to reduce a directed graph to a DAG.
The reduced DAG will maintain the graph hierarchy of the original graph as much as possible.
The corresponding code is available on Github: https://github.com/zhenv5/breaking_cycles_in_noisy_hierarchies
The reduced DAG will maintain the graph hierarchy of the original graph as much as possible.
The corresponding code is available on Github: https://github.com/zhenv5/breaking_cycles_in_noisy_hierarchies
Context
StackExchange Computer Science Q#90481, answer score: 10
Revisions (0)
No revisions yet.