Given a directed graph, return a number of edges that may be required to remove all cycles from the graph.
const toDAG = require('directed-graph-to-dag')const digraph = require('digraph-tag')const graph = digraph`A -> BB -> CC -> DD -> A`toDAG(graph) // Set([C -> D])
Vertex (whatever type you provide) to
Edge will be defined as
A set containing vertices are known as
Given a graph defined by
vertices, incoming edges
in, outgoing edges
out, and optional
dst, return a set of edges that may be required to
turn the graph into a DAG.
Note: the only guarantee is that a cyclical graph will become acyclical by reversing the resulting edges, not that an existing acyclical graph will have no edges recommended for reversal.