1
$\begingroup$

Is there a Mathematica implementation/package that displays all topological sorts (i.e. linear extensions) of a partial order using labelled Hasse diagrams (nodes labeled with the appropriate topological sort values)?

For instance, consider the partial order determined by the pairs (a,c), (b,c) (two independent elements a and b, with a maximum c above it in the Hasse diagram). Is there a package to display the two topological sorts (linear extensions) using the numbers 1, 2, 3 via labeled Hasse Diagrams? In the first labeled Hasse Diagram, the node a is labeled with 1, b with 2 and c with 3. In the second labeled Hasse diagram, the node a is labeled with 2, b with 1 and c with 3. The Hasse diagram is displayed as a "hat"-shaped (^) graph, with labels.

I would need code that is adaptable to move labels around via various operations. So a proprietary package from Mathematica for which code is not accessible would not help.

$\endgroup$
4
  • 1
    $\begingroup$ Maybe something like Graph[{hasseData}, GraphLayout -> {"LayeredEmbedding", "Orientation" -> Bottom}] Something to work with would better attract help. $\endgroup$ – Michael E2 Feb 22 at 19:27
  • 1
    $\begingroup$ TransitiveReductionGraph[Graph[{b, a, c}, {a -> c, b -> c}], VertexLabels -> Placed[{"Name", "Index"}, {Before, After}]] and TransitiveReductionGraph[Graph[{a, b, c}, {a -> c, b -> c}], VertexLabels -> Placed[{"Name", "Index"}, {Before, After}]]? $\endgroup$ – kglr Feb 22 at 20:19
  • $\begingroup$ Thanks kglr. Could this be adapted to display all permutations of labels 1 through 3 on the vertices? $\endgroup$ – Mike 2 days ago
  • $\begingroup$ Mike, the vertex indices are assigned based on the ordering of the vertex list. So you can use any permutation of {a,b,c} as the first argument in Graph[...] to assign desired indices to the vertices. $\endgroup$ – kglr yesterday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.