1

Let's say I have a cyclic control flow graph

A -> B -> C -> D -> G
     ^         |
     |         v
     F <------ E

Each node is associated with a cost. I additionally have a state variable that is modified each time I enter node D. The probability of D -> E and D -> G is determined by this state variable.

What I want is to enumerate all possible paths (at a certain state P( D -> G) = 1), and find the probability and cost for each path. The first step, I think is transforming this control flow graph with state variable to a directed acyclic graph by unrolling it. Is there a straightforward algorithm for this? Any libraries (like networkx) that can help?

sheridp
  • 1,386
  • 1
  • 11
  • 24

1 Answers1

2

I don't think it's possible.

https://cs.stackexchange.com/questions/90481/how-to-remove-cycles-from-a-directed-graph

You can always make a digraph acyclic by removing all edges.

Lance
  • 75,200
  • 93
  • 289
  • 503