It appears that only one subgraph’s attributes can apply to a node (object), even if subsequent subgraphs (try to) apply different attributes.
e.g. why is node a not colored green?
node [shape=circle style=filled color=lightblue]
{ node [color=pink]
c f i p
}
{
node [shape=square] // why not c ?
a b c
}
{ node [color=green] // why not a ?
a d g
}
{
node [shape=triangle] // why not d & f ?
d e f
}
{
node [shape=pentagon] // why not g & i ?
g h i
}
}
It works that way because objects get the default attributes of the enclosing graph/subgraph at the point where they are created. If they are already created, they are not changed.
On a related topic, over the years we have wanted to implement graph object classes but we never worked out the details of how the library API would work, or how we would handle I/O (specifically graph writing) since we do not preserve the graph parse tree but basically reconstruct it based on the semantics of API calls.