DEV Community

Discussion on: Spinning Around In Cycles With Directed Acyclic Graphs

Collapse
 
quickdudley profile image
Jeremy List

In one of my projects I had to go one step further: directed graphs with two sets of edges (called red and black) where cycles of black edges is allowed but any cycle including a red edge is forbidden. You can check whether or not a graph fits these criteria using Tarjan's algorithm for strongly connected components.