Graphviz, changing the size of edge

I wanted to supplement shuvalov’s answer. penwidth is indeed the correct command. Additionally, 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 might also wish to change the
    size/weight of the arrowhead and
    arrowtail, along with the edge
    weight
    , so that all three remain
    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 {
    /* declare the node & style them */
    "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" ]

    /* declare the edges & style them */
    "Node 1" -> "Node 2" [dir=none, weight=1, penwidth=3] ;
    "Node 1" -> "Node 3" [dir=none, color="#9ACEEB"] ;
    "Node 1" -> "Node 4" [arrowsize=.5, weight=2.]
}

enter image description here

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)