Hi, I'm posting again a question that got confused due to mistakes from my part... I'd like to clarify a point about internal properties accessed through a subgraph. According to the documentation of the method "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
/*
Sample output:
After initializing properties for G1:
Global and local properties for vertex G0[C]...
G0[C]= C
G1[A1]= A1
Global and local properties for vertex G0[E]...
G0[E]= E
G1[B1]= B1
Global and local properties for vertex G0[F]...
G0[F]= F
G1[C1]= C1
After initializing properties for G2:
Global and local properties for vertex G0[A]
G0[A]= A
G2[A2]= A2
Global and local properties for vertex G0[C]...
G0[C]= C
G1[A1]= A1
G2[B2]= B2
*/
#include
Hi Hugues, I think that is a bug. I'll look into fixing it. Regards, Jeremy On Feb 3, 2004, at 8:32 AM, Hugues Joly wrote:
Hi, I'm posting again a question that got confused due to mistakes from my part...
I'd like to clarify a point about internal properties accessed through a subgraph. According to the documentation of the method "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/* Sample output:
After initializing properties for G1: Global and local properties for vertex G0[C]... G0[C]= C G1[A1]= A1 Global and local properties for vertex G0[E]... G0[E]= E G1[B1]= B1 Global and local properties for vertex G0[F]... G0[F]= F G1[C1]= C1
After initializing properties for G2: Global and local properties for vertex G0[A] G0[A]= A G2[A2]= A2 Global and local properties for vertex G0[C]... G0[C]= C G1[A1]= A1 G2[B2]= B2
*/
#include
#include <iostream> #include #include #include int main(int,char*[]) { using namespace boost; //typedef adjacency_list_traits
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
> > Graph; const int N = 6; Graph G0(N); enum { A, B, C, D, E, F}; // for conveniently refering to vertices in G0
property_map
::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
::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
::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; } _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Jeremy Siek
Hi Hugues,
I've checked in a fix to CVS. Sorry, but this fix won't make it into the
imminent release of boost 1.31.0.
Anyways, your program now gives the following output:
After initializing properties for G1:
Global and local properties for vertex G0[C]...
G0[C]= A1
G1[A1]= A1
Global and local properties for vertex G0[E]...
G0[E]= B1
G1[B1]= B1
Global and local properties for vertex G0[F]...
G0[F]= C1
G1[C1]= C1
After initializing properties for G2:
Global and local properties for vertex G0[A]
G0[A]= A2
G2[A2]= A2
Global and local properties for vertex G0[C]...
G0[C]= B2
G1[A1]= B2
G2[B2]= B2
Cheers,
Jeremy
P.S. The subgraph class was a late addition to the graph library
and it is a fairly complicated class that was not well tested. I would
not
be surprised if there are more bugs.
_______________________________________________
Jeremy Siek
Hi,
I've just received the User Guide of the BGL from
Addison Wesley and it doesn't mention anything about
the subgraphs. What are the future plans regarding
this feature?
--- Jeremy Siek
I've checked in a fix to CVS. Sorry, but this fix won't make it into the imminent release of boost 1.31.0.
Anyways, your program now gives the following output:
After initializing properties for G1: Global and local properties for vertex G0[C]... G0[C]= A1 G1[A1]= A1 Global and local properties for vertex G0[E]... G0[E]= B1 G1[B1]= B1 Global and local properties for vertex G0[F]... G0[F]= C1 G1[C1]= C1
After initializing properties for G2: Global and local properties for vertex G0[A] G0[A]= A2 G2[A2]= A2 Global and local properties for vertex G0[C]... G0[C]= B2 G1[A1]= B2 G2[B2]= B2
Cheers, Jeremy
P.S. The subgraph class was a late addition to the graph library and it is a fairly complicated class that was not well tested. I would not be surprised if there are more bugs.
_______________________________________________ Jeremy Siek
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
Hi Hugues, The subgraph class has been in releases of boost for some time now, and will continue to be. As for the BGL book, the subgraph class didn't make it into the book for two reasons: we had a strict page limit and also the subgraph class was not finalized in time for the book. As for future versions of the BGL book... I don't know if there will be a second edition. That depends on sales. If there ever is a second edition, I'll try to get subgraph in there. Cheers, Jeremy On Feb 4, 2004, at 3:07 PM, Hugues Joly wrote:
Hi, I've just received the User Guide of the BGL from Addison Wesley and it doesn't mention anything about the subgraphs. What are the future plans regarding this feature?
--- Jeremy Siek
a écrit : > Hi Hugues, I've checked in a fix to CVS. Sorry, but this fix won't make it into the imminent release of boost 1.31.0.
Anyways, your program now gives the following output:
After initializing properties for G1: Global and local properties for vertex G0[C]... G0[C]= A1 G1[A1]= A1 Global and local properties for vertex G0[E]... G0[E]= B1 G1[B1]= B1 Global and local properties for vertex G0[F]... G0[F]= C1 G1[C1]= C1
After initializing properties for G2: Global and local properties for vertex G0[A] G0[A]= A2 G2[A2]= A2 Global and local properties for vertex G0[C]... G0[C]= B2 G1[A1]= B2 G2[B2]= B2
Cheers, Jeremy
P.S. The subgraph class was a late addition to the graph library and it is a fairly complicated class that was not well tested. I would not be surprised if there are more bugs.
_______________________________________________ Jeremy Siek
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 _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Jeremy Siek
participants (2)
-
Hugues Joly
-
Jeremy Siek