ordering attribute is ignored as a subgraph attribute
Steps to reproduce
digraph {
// ordering applied to subgraph - fails
{
graph [ordering=out]
T1 u1 v1 w1 x1 y1 z1
T1 -> x1
T1 -> z1
T1 -> y1
T1 -> w1
T1 -> v1
T1 -> u1
}
label= "should be ?
x1 z1 y1 w1 v1 u1
same subgraph"
}
Expected Behaviour
Nodes in this order: x1 z1 y1 w1 v1 u1
Actual Behaviour
OS Version
Windows/macOS/Linux/BSD? What version?
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal
Graphviz Version
dot - graphviz version 10.0.0~dev.20231204.0707 (20231204.0707)
Additional info
(This Issue is based on results of simple debugging statements inserted into do_ordering_node in mincross.c)
Page 15 of "Drawing graphs with dot" (https://www.graphviz.org/pdf/dotguide.pdf) says:
If a subgraph has ordering=out, then out-edges within the subgraph that have the same tail
node will fan-out from left to right in their order of creation.
The online documentation for the ordering attribute (https://www.graphviz.org/docs/attrs/ordering/) is more ambiguous. It says
If defined as a graph or subgraph attribute, the value is applied to all nodes
in the graph or subgraph.
But it also says:
Valid on:
- Graphs
- Nodes
e.g. not subgraphs
If the bug is in the code,
- the code should be made to work in a similar manner to the rank attribute for subgraphs
- the documentation should include subgraphs
If the bug is only in the documentation (e.g. ordering will not apply to subgraphs) - the documentation should be "fixed" to make this clear
- (enhancement) the code should be enhanced to flag attempts to apply ordering to subgraphs
The ordering attribute represents a powerful and complex concept, but it needs to be cleaned up.