Boost logo

Boost Users :

From: Andreas Scherer (andreas_at_[hidden])
Date: 2004-05-31 14:22:45


Dear Group,

During some initial experiments with the BGL-GraphViz interface, I observed a
significant asymmetry between a given DOT graph input with
boost::read_graphviz() and output with boost::write_graphviz() (without
changing any attributes).

Given the input DOT file (which is, of course, much longer with the full set
of information)

<metro.dot>
graph metro
{
        node[ fontname = "luxirr", style = filled, fillcolor = white ];
        "Arts et Métiers";

        subgraph ligne_1
        {
                node[ fillcolor = "orange" ];
                "La Défense/Grande Arch" -- "Esplanade de la Défense";
        }
}
</metro.dot>

The elementary BGL program

<metro.cxx>
#include <boost/graph/graphviz.hpp>

int main( void )
{
        boost::GraphvizGraph g_dot;
        boost::read_graphviz( "metro.dot", g_dot );
        boost::write_graphviz( "metro_boost.dot", g_dot );
}
</metro.cxx>

transforms this into the output DOT file

<metro_boost.dot>
graph ligne_1 {
node [fillcolor="orange", fontname="luxirr", style="filled"];
subgraph ligne_1 {
node [fillcolor="orange", fontname="luxirr", style="filled"];
1[label="La Défense/Grande Arch"];
2[label="Esplanade de la Défense"];
1 -- 2;
}
0[label="Arts et Métiers"];
}
</metro_boost.dot>

It seems that somewhere on the way, the graph and node (and edge) attributes
get clobbered. Note that even the graph name "metro" gets replaced by the
name of the (last) subgraph "ligne_1", and /all/ node attributes get mixed
up. This seems to be somewhat similar to the recent edge-related problem
posted by Hideaki Hiraki.

I have not (yet) tried to mess with the graphviz parser code, so I am asking
here for help. Thanks.

Greetings,
Andreas


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net