Search code examples
graphviz

How can I cross out a node in Graphviz?


I would like to indicate that a node should be there, but is currently lacking in the process. Intuitively I would like to cross it out as shown in below image (now done manually in Paint):

enter image description here

Is there a node attribute in Graphviz that I can use for this?


Solution

  • While the answer of sroush gives me the exact output I need, it requires that I understand how to introduce gvpr in my workflow which will take a bit of time.

    In the meantime I came up with a dot only approach, which approximates crossing out a node sufficiently for my purpose.

    In below graph I would like to cross out the node Some process:

    digraph graphname {
        rankdir=LR
        node [fillcolor="lightblue3", style="filled"]
            a
            c
            d
            b [label="Some\nprocess"]
        a -> b -> c
        a -> d -> c
        {rank=same a;d}
    }
    

    enter image description here

    To do so I change:

    • the nodestyle of the Some process node to have a diagonal hard gradient
    • use a HTML-like label to strikethrough the text
    • Make the fontcolor and node outline a shade of gray
    digraph graphname {
        rankdir=LR
        node [fillcolor="lightblue3", style="filled"]
            a
            c
            d
        node [fillcolor="lightblue3;0.5:white", style="filled", fontcolor="gray50", color="gray50", gradientangle=100]
            b [label=<<s>Some<br/>process</s>>]
        a -> b -> c
        a -> d -> c
        {rank=same a;d}
    }
    

    enter image description here