Is it possible to define a second node type

I have the following in my code:
node [ fontsize = 9, shape = circle ]

But I also often have something like the following:
S3 [ pos = "2,0!",
style = "filled", color = "red", fontcolor = "white" ]

When I decide to change this, I have to change this in a lot of places. Is it possible to define this in one place and use the defined value? So when I need to change it, I only need to change it at one place and all the nodes that use it are changed?

There were some plans to

There were some plans to provide macros or styles in the dot language to handle this, but we haven't done it yet. At present, the simplest mechanism to get what you want it to put in another node statement and then declare all of the nodes that you want to have that style:

node [ fontsize = 9, shape = circle ]

a b c d e

node [style = "filled", color = "red", fontcolor = "white" ]

s3 [ pos = "2,0!]  s4 s5 s6

or you can put this into a subgraph to limit the scope of the node statement:

{

node [style = "filled", color = "red", fontcolor = "white" ]

s3 [ pos = "2,0!]  s4 s5 s6

}

Works greath

I was worried that I had to take the definitions apart, but the following works:
digraph finiteStateMachine {
graph [ fontsize = 9, rankdir = LR ]
node [ fontsize = 9, shape = circle ]
edge [ fontsize = 9 ]

{
node [ style = "filled", color = "red", fontcolor = "white" ]

S3 S5 S9 S13 S16 S18
}

S0 [ pos = "0,2!" ]
S1 [ pos = "2,2!" ]
S2 [ pos = "4,2!" ]
S3 [ pos = "2,0!" ]
.
.
.

Thanks.

Recent comments