Boost logo

Boost Users :

From: odisseo_at_[hidden]
Date: 2005-07-14 16:50:14


Look at the following code, as you it print out:

-----------
name: graph
name sg1: subgraph 3
name sg2: subgraph 3
name sg3: subgraph 3
-----------

when I waiting for

-----------
name: graph
name sg1: subgraph 1
name sg2: subgraph 2
name sg3: subgraph 3
-----------

WHY?
Is this a bug in the library?

#include <string>
#include <iostream>

using namespace std;

#include <boost/config.hpp>

#include <boost/graph/graphviz.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>

int main() {
    boost::GraphvizDigraph gr;
    boost::get_property(gr, boost::graph_name) = "graph";
    std::cout << "name: " << get_property(gr, boost::graph_name) << std::endl;
    
    boost::subgraph<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::GraphvizVertexProperty, boost::GraphvizEdgeProperty, boost::GraphvizGraphProperty, boost::listS> > sg1 = gr.create_subgraph();
    get_property(sg1, boost::graph_name) = "subgraph 1";
    
    boost::subgraph<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::GraphvizVertexProperty, boost::GraphvizEdgeProperty, boost::GraphvizGraphProperty, boost::listS> > sg2 = gr.create_subgraph();
    get_property(sg2, boost::graph_name) = "subgraph 2";
    
    boost::subgraph<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::GraphvizVertexProperty, boost::GraphvizEdgeProperty, boost::GraphvizGraphProperty, boost::listS> > sg3 = gr.create_subgraph();
    get_property(sg3, boost::graph_name) = "subgraph 3";
    
    std::cout << "name sg1: " << get_property(sg1, boost::graph_name) << std::endl;
    std::cout << "name sg2: " << get_property(sg2, boost::graph_name) << std::endl;
    std::cout << "name sg3: " << get_property(sg3, boost::graph_name) << std::endl;
}


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