Oops, sorry, I meant to send you a cpp file. Consider that my previous email was referring to this attachement. Thanks in advance. --- Jeremy Siek <jsiek@osl.iu.edu> a écrit : > Hi Hugues,
Subgraph.mcp is a CodeWarrior project file? I'm sorry but I don't have CodeWarrior. Can you send a tar ball or even better, a text file.
Cheers, Jeremy
On Jan 30, 2004, at 12:59 PM, Hugues Joly wrote:
Hi, I'd like to clarify a point about the graph properties accessed through a subgraph. According to the documentation of get(PropertyTag, subgraph& g): vertex and edge properties are shared by all subgraphs, so changes to a property through a local vertex descriptor for one subgraph will change the property for the global vertex descriptor, and therefore for all other subgraphs (c.f. boost-1.30.2/libs/graph/doc/subgraph.html).
Here, I'm sending you a small program inspired by the boost-1.30.2/libs/graph/example/subgraph.cpp example.
From its behavior, it seems that:
1) A property value is not shared between the global descriptor and its corresponding local descriptors.
2) we need to initialize property values for each of the subgraphs. For example, if I set a name "A" for the global vertex descriptor A, that property is not seen through the corresponding local vertex descriptors.
Is this a case of misuse or is it a bug?
__________________________________________________________
Lèche-vitrine ou lèche-écran ?
magasinage.yahoo.ca<Subgraph.mcp>______________________________________
_________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Jeremy Siek <jsiek@osl.iu.edu> http://www.osl.iu.edu.edu/~jsiek Ph.D. Student, Indiana University Bloomington C++ Booster (http://www.boost.org) Office phone: (812) 856-1820 _______________________________________________
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users __________________________________________________________ Lèche-vitrine ou lèche-écran ? magasinage.yahoo.ca //======================================================================= // Copyright 2001 University of Notre Dame. // Author: Jeremy G. Siek // // This file is part of the Boost Graph Library // // You should have received a copy of the License Agreement for the // Boost Graph Library along with the software; see the file LICENSE. // If not, contact Office of Research, University of Notre Dame, Notre // Dame, IN 46556. // // Permission to modify the code and to distribute modified code is // granted, provided the text of this NOTICE is retained, a notice that // the code was modified is included with the above COPYRIGHT NOTICE and // with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE // file is distributed with the modified code. // // LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. // By way of example, but not limitation, Licensor MAKES NO // REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY // PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS // OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS // OR OTHER RIGHTS. //======================================================================= /* Sample output: G0: 0 --> 1 1 --> 2 3 2 --> 5 3 --> 4 --> 1 5 5 --> 3 0(0,1) 1(1,2) 2(1,3) 6(2,5) 3(4,1) 4(4,5) 5(5,3) G1: 2 --> 5 4 --> 5 5 --> 6(2,5) 4(4,5) G2: 0 --> 1 1 --> 0(0,1) */ #include <boost/config.hpp> #include <iostream> #include <boost/graph/subgraph.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/graph_utility.hpp> int main(int,char*[]) { using namespace boost; typedef adjacency_list_traits<vecS, vecS, directedS> Traits;// Does nothing? typedef property< vertex_color_t, int, property< vertex_name_t, std::string > > VertexProperty; typedef subgraph< adjacency_list<vecS, vecS, directedS, VertexProperty, property<edge_index_t, int> > > Graph; const int N = 6; Graph G0(N); enum { A, B, C, D, E, F}; // for conveniently refering to vertices in G0 property_map<Graph, vertex_name_t>::type name = get(vertex_name_t(), G0); name[A] = "A"; name[B] = "B"; name[C] = "C"; name[D] = "D"; name[E] = "E"; name[F] = "F"; Graph& G1 = G0.create_subgraph(); enum { A1, B1, C1 }; // for conveniently refering to vertices in G1 add_vertex(C, G1); // global vertex C becomes local A1 for G1 add_vertex(E, G1); // global vertex E becomes local B1 for G1 add_vertex(F, G1); // global vertex F becomes local C1 for G1 property_map<Graph, vertex_name_t>::type name1 = get(vertex_name_t(), G1); name1[A1] = "A1"; std::cout << std::endl << "After initializing properties for G1:" << std::endl; std::cout << " Global and local properties for vertex G0[C]..." << std::endl; std::cout << " G0[C]= " << boost::get(vertex_name, G0, C) << std::endl;// prints: "G0[C]= C" std::cout << " G1[A1]= " << boost::get(vertex_name, G1, A1) << std::endl;// prints: "G1[A1]= A1" name1[B1] = "B1"; std::cout << " Global and local properties for vertex G0[E]..." << std::endl; std::cout << " G0[E]= " << boost::get(vertex_name, G0, E) << std::endl;// prints: "G0[E]= E" std::cout << " G1[B1]= " << boost::get(vertex_name, G1, B1) << std::endl;// prints: "G1[B1]= B1" name1[C1] = "C1"; std::cout << " Global and local properties for vertex G0[F]..." << std::endl; std::cout << " G0[F]= " << boost::get(vertex_name, G0, F) << std::endl;// prints: "G0[F]= F" std::cout << " G1[C1]= " << boost::get(vertex_name, G1, C1) << std::endl;// prints: "G1[C1]= C1" Graph& G2 = G0.create_subgraph(); enum { A2, B2 }; // for conveniently refering to vertices in G2 add_vertex(A, G2); // global vertex A becomes local A2 for G2 add_vertex(C, G2); // global vertex C becomes local B2 for G2 property_map<Graph, vertex_name_t>::type name2 = get(vertex_name_t(), G2); name2[A2] = "A2"; std::cout << std::endl << std::endl << "After initializing properties for G2:" << std::endl; std::cout << " Global and local properties for vertex G0[A]" << std::endl; std::cout << " G0[A]= " << boost::get(vertex_name, G0, A) << std::endl;// prints: "G0[A]= A" std::cout << " G2[A2]= " << boost::get(vertex_name, G2, A2) << std::endl;// prints: "G2[A2]= A2" name2[B2] = "B2"; std::cout << " Global and local properties for vertex G0[C]..." << std::endl; std::cout << " G0[C]= " << boost::get(vertex_name, G0, C) << std::endl;// prints: "G0[C]= C" std::cout << " G1[A1]= " << boost::get(vertex_name, G1, A1) << std::endl;// prints: "G1[A1]= A1" std::cout << " G2[B2]= " << boost::get(vertex_name, G2, B2) << std::endl;// prints: "G2[B2]= B2" return 0; }