Boost logo

Boost :

Subject: [boost] Problem with write_graphviz
From: Josep TORRAS FLAQUER (josep.torras-flaquer_at_[hidden])
Date: 2009-04-16 11:24:42

I'm working with boost graph library. I'm creating a graph and i'd like
to write its description into a file or to display it on the screen.
The properties of Edges and Vertex are bundled, and i'm not able to
write them. I have read the doc once and again and i don't get to find a
solution. I have looked for examples but i haven't found anything
actually useful for me.
Could anyone please help me or propose a possible solution?

Here is my code:
#include <boost/graph/iteration_macros.hpp>

#include <string>
#include <boost/tuple/tuple.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/visitors.hpp>
#include <boost/graph/breadth_first_search.hpp>
#include <map>
#include <boost/graph/adj_list_serialize.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/multi_array.hpp>
#include <cassert>
#include <boost/graph/graphviz.hpp>
//using namespace boost;

struct VertexProperties{

    std::string gate_type;
    int gate_level;
    int gate_index;
    int num_input;
    float prob_err;

struct edge_properties {

    std::string name;

typedef boost::adjacency_list<boost::vecS, boost::vecS,
boost::undirectedS, VertexProperties , edge_properties> Graph;

typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
typedef boost::graph_traits<Graph>::edge_descriptor Edge;

int main()
    int i=0;
    //const char* name = "123";

    Graph g;

    Vertex u1;
    g[u1].gate_type = "Input";

    Vertex u2;
    g[u2].gate_type = "Input";

    Vertex u3;
    g[u3].gate_type = "Input";

    Vertex u4;
    g[u4].gate_type = "XOR";

    Vertex u5;
    g[u5].gate_type = "AND";

    Vertex u6;
    g[u6].gate_type = "XOR";

    Vertex u7;
    g[u7].gate_type = "AND";

    Vertex u8;
    g[u8].gate_type = "OR";

    Edge e1;

    Edge e2;

    Edge e3;

    Edge e4;

    Edge e5;

    Edge e6;

    Edge e7;

    Edge e8;

    Edge e9;

    Edge e10;

    const char* name[] = { "Input 1", "Input 2", "Input
    int index[] =


    write_graphviz(std::cout, g, boost::make_label_writer(name));


I am able to write a label, but i can't write all the properties, and
that's what i want.

Thank you.


Boost list run by bdawes at, gregod at, cpdaniel at, john at