Hi,
How to change the size of edge in dot (graphviz)? I would like to make some edges "bolded".
Thanks.
Hi,
How to change the size of edge in dot (graphviz)? I would like to make some edges "bolded".
Thanks.
try this:
"NodeA" [ penwidth = 5]
"NodeB" [ penwidth = 5]
NodeA->NodeB [ penwidth = 3]
I wanted to clarify shuvalov's answer. "penwidth" is indeed the correct command. In shuvalov's answer "penwidth" is both a node and an edge property, also correct. The distinction i wanted to make:
"penwidth", when used as a node property (e.g., "NodeA" [penwidth = 5]) affects the border line weight for that node
"penwidth" when used as a edge property affects the line weight of the edge (default value is "1", specifying penwidth=2 will make the edge appear in "bold" type
if you want to change the line weight of an edge, you do not need to change "penwidth" for the two nodes connected by that edge (as shuvalev's answer might suggest)
for a directed graph (the edges have a direction) you can also change the size/weight of the arrowhead and arrowtail, along with the edge weight, so that all three are proportional
the length of an edge can be changed by setting the "weight" property, as elsewhere, the default value is 1.0, increasing that value increases the cost of stretching this edge during rendering (i.e., the drawing algorithm applies a higher penalty to solutions in which this edge is longer); notice that the edge from 1 to 4 is shorter than the edge from 1 to 2.
The following code should illustrate all of this. The rendered graph is shown below the code.
digraph {
"Node 1" [shape=diamond, penwidth=3, style=filled,fillcolor="#FCD975"] ;
"Node 2" [style=filled,fillcolor="#9ACEEB" ] ;
"Node 3" [shape=diamond, style=filled,fillcolor="#FCD975" ] ;
"Node 4" [style=filled, fillcolor="#9ACEEB" ]
"Node 1" -> "Node 2" [dir=none,weight=1, penwidth=3] ;
"Node 1" -> "Node 3" [dir=none, color="#9ACEEB"] ;
"Node 1" -> "Node 4" [arrowsize=0.5, weight=2.0]
}