Function sortDagDfs

  • Sorts a directed acyclic graph (DAG) using depth-first search (DFS).

    Parameters

    • edges: any

    Returns any[]

    Example

    const edges = [
    ["a", "b"],
    ["a", "c"],
    ["a", "e"],
    ["b", "d"],
    ["c", "d"],
    ["d", "e"],
    ];

    const order = sort_dag_dfs(edges); // ["a", "c", "b", "d", "e"]

Generated using TypeDoc