When called with topDown = truetopLayer should be untouched, and
bottomLayer should be rearranged to minimize crossings. When
topDown = false then topLayer should be rearranged, and bottomLayer
should remain fixed. There are no requirements for how these needs to order
nodes, but doing so in such a way to minimize edge crossings is usually
desired.
Example
It's unlikely that you'll need to implement a custom two-layer operator as
this is already a heuristic solution to decrossing. However, in the event
that you do, we illustrate how to implement one where the order is stored in
the original nodes. Here dummy nodes (nodes that exist on long edges between
"real" nodes) are ordered according to the average value of their source and
target nodes.
an operator for optimizing decrossings one layer at a time.
This is used to customize DecrossTwoLayer.
When called with
topDown = true
topLayer
should be untouched, andbottomLayer
should be rearranged to minimize crossings. WhentopDown = false
thentopLayer
should be rearranged, andbottomLayer
should remain fixed. There are no requirements for how these needs to order nodes, but doing so in such a way to minimize edge crossings is usually desired.Example
It's unlikely that you'll need to implement a custom two-layer operator as this is already a heuristic solution to decrossing. However, in the event that you do, we illustrate how to implement one where the order is stored in the original nodes. Here dummy nodes (nodes that exist on long edges between "real" nodes) are ordered according to the average value of their source and target nodes.