Interface LayeringSimplex<Ops>

A layering operator that assigns layers to minimize the number of dummy nodes (long edges) added to the layout.

Computing this layering requires solving an integer linear program, which may take a long time, although in practice is often quite fast. This is often known as the network simplex layering from Gansner et al. [1993].

Because this is solving a linear program, it is relatively easy to add new constraints. The current implementation allows specifying rank constraints that indicate which nodes should be above other nodes, or group constraints that say which nodes should be on the same layer. Note that adding these constraints can cause the optimization to become ill-defined.

Create with layeringSimplex.

Type Parameters

Hierarchy

  • Layering<OpsNodeDatum<Ops>, OpsLinkDatum<Ops>>
    • LayeringSimplex
  • layer a graph

    After calling this, every node should have a y coordinate that satisfies sep.

    Type Parameters

    • N extends unknown

    • L extends unknown

    Parameters

    • graph: Graph<N, L>

      the graph to layer

    • sep: Separation<N, L>

      the minimum separation between nodes

    Returns number

    height - the height after layering

Methods

Methods

  • set the Group

    Any node with a group assigned will have a second ordering enforcing all nodes with the same group have the same layer. Note, this can cause the simplex optimization to be ill-defined, and may result in an error during layout.

    Type Parameters

    • NewGroup extends Group<never, never>

    Parameters

    • newGroup: NewGroup

    Returns LayeringSimplex<U<Ops, "group", NewGroup>>

  • get the current Group

    Returns Ops["group"]

  • set the Rank

    Any node with a rank assigned will have a second ordering enforcing ordering of the ranks. Note, this can cause the simplex optimization to be ill-defined, and may result in an error during layout.

    Type Parameters

    • NewRank extends Rank<never, never>

    Parameters

    • newRank: NewRank

    Returns LayeringSimplex<U<Ops, "rank", NewRank>>

  • get the current Rank

    Returns Ops["rank"]

Generated using TypeDoc