Are there any routines in Mathematica for topological sorting or generating graphs for partially ordered sets? I think these are also called directed acyclic graphs, also used in PERT charts in project management.
Here is a matrix for nine nodes. The matrix contains a 1 if node i precedes node j and 0 otherwise.
{{0, 1, 1, 1, 1, 1, 1, 1, 1},
{0, 0, 0, 1, 1, 1, 1, 1, 1},
{0, 0, 0, 1, 0, 1, 1, 1, 1},
{0, 0, 0, 0, 0, 1, 1, 1, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 0}}
The graph should have an edge if x precedes y and there is no z such that x precedes z precedes y, which means some of the 1's must be removed to have an adjacency matrix.