
Thanks for your help. But if I have a list of structures like this how can I implement a graph? typedef struct Conceptual { char* Name; char* Type; Conceptual* Next; Conceptual() {Next=NULL; Name=NULL; Type=NULL; } }; typedef Conceptual* ListPtr; I have think to create a univocal variable for every word and to create a dynamic matrix of connections or a pointer inside the list of structure, I haven't also decide. Thanks Daniele Doug Gregor wrote:
On Jul 12, 2004, at 3:36 AM, Daniele Carlucci wrote:
Hi all, I'm a newby in this library. I'm interested to make a graph of network. It's possible or is very hard to make? I want to have inside every node a struct.
Anything is possible with the BGL :) This particular thing is too hard to do at the moment, but will become much easier as soon as we release 1.32.0 (in about 2 weeks):
First step is to create a property tag for your struct:
enum vertex_mystruct_t { vertex_mystruct };
Now make that tag a full-fledged graph property tag:
namespace boost { BOOST_INSTALL_PROPERTY(vertex, mystruct); }
Now when you create your graph type, you can store a value of any type X along with each vertex like this (the first three parameters can be anything, of course):
struct X { int foo; };
typedef adjacency_list
> Graph; Graph g; // creating a graph instance To actually get at the X values for each vertex, we need to grab the property map:
property_map
::type X_map(get(vertex_mystruct, g)); Now, finally, we can get to the X structure for any vertex_descriptor v:
X_map[v].foo = 17;
In 1.32.0, the BGL will support "bundled properties", which means that this whole e-mail would boil down to:
typedef adjacency_list
Graph; Graph g; graph_traits<Graph>::vertex_descriptor v = ...; g[v].foo = 17; Doug
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users