SVG id

Hi,
can graph id be added as id in svg output?
So example following graph
digraph mysvg{
    a -> c
}
Will  produce followig svg.
<svg width="62pt" height="116pt"
 viewBox="0.00 0.00 62.00 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
.
.
</svg>
I would like to have id generated to svg
 
<svg id="mysvg" width="62pt" height="116pt"
 viewBox="0.00 0.00 62.00 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
.
.
</svg>
Is this possible?
--Ari
 

SVG id

For svg output, id attributes are automatically created for all graph elements. You can tailor these to your application by explicitly setting the id attribute, so using
digraph mysvg{
   id = mysvg
    a -> c
}
will produce
<g id="mysvg" class="graph".....
If you really want the id to go into the <svg> element, that is not provided by Graphviz, but can be easily added by a post-processing filter, e.g.,
 
dot -Tsvg mysvg.gv | sed 's/<svg /<svg id="mysvg" /' > mysvg.svg

Recent comments