graph2dag function

Convert directed graphs to directed acyclic graphs (DAGs)