CBK
CBK

Reputation: 700

GraphViz - Link Edge Label to Another Dot Graph

I've been looking for a solution to this but I cannot seem to find one for linking an edge label to another GraphViz Dot Graph. For example, if I have a graph called 'mydotimage2.svg' produced from the following:

digraph G
{
    graph [compound = true];

    subgraph cluster_0
    {
        node [style = bold];
        "A" "B" "C";
    }

    subgraph cluster_1
    {
        node [style = bold];
        "One" "Two" "Three";
    }

    "A" -> "One" [lhead = cluster_1, ltail = cluster_0, label = "Falafel", href = "~/workspace/GraphViz/mydotimage1.svg"]
}

If I create the 'mydotimage2.svg' SVG image in my terminal via:

dot -T svg mydotimage2.dot > mydotimage2.svg

The image opens just fine in my browser, and the edge label from A to One in the produced image is clickable, but does not open mydotimage1.svg which is in the same GraphViz directory as well. Does anyone know how to do this? I would really appreciate it. Thanks in advance.

Upvotes: 2

Views: 2666

Answers (2)

user882813
user882813

Reputation: 835

You should use relative paths. That is, instead of href = "~/workspace/GraphViz/mydotimage1.svg" use href = "./mydotimage1.svg"

BTW, instead of using pipe redirection(>) you can specify desired output file name as a parameter to the dot.
Just append -omydotimage2.svg to the command line. Where "mydotimage2.svg" is the file name you want to write to.

Upvotes: 1

vaettchen
vaettchen

Reputation: 7659

This is what I observe on my machine, I guess it's a general problem:

graphviz does expand the tilde ~ to but it does not remove the tilde. In my case I see /home/rainer/~/workspace/GraphViz/mydotimage1.svg as image location when I click on the hyperlink in the graph. That obviously doesn't exist. Looks like a bug to me...

The solution / workaround is to replace the ~ in the script with your home folder path, in my case

href = "/home/rainer/workspace/GraphViz/mydotimage1.svg"

which works as expected.

Upvotes: 1

Related Questions