Storing vertex objects and edge objects in a BGL graph?
Hi, I'd like to know if it's possible to create a BGL graph that uses custom-made classes for the nodes and the edges. While looking to your documentation, I came across the following: "Many graph representations (such as adjacency lists) do not store actual vertex objects, while others do (e.g., pointer-linked graphs)." (c.f. boost-1.30.2/libs/graph/doc/quick_tour.html) Is the pointer-linked graph implementation supplied from boost or do I have to create one and use external adaptation for using it with your library? Thanks in advance. __________________________________________________________ Lèche-vitrine ou lèche-écran ? magasinage.yahoo.ca
On Mon, 26 Jan 2004, [iso-8859-1] Hugues Joly wrote: hjoly2> Hi, hjoly2> I'd like to know if it's possible to create a BGL hjoly2> graph that uses custom-made classes for the nodes and hjoly2> the edges. The answer is yes and no. You can't use your own vertex and edge classes. However, you can tell adjacency_list to store extra stuff of your choosing with each vertex and edge, that is, using internal properties. hjoly2> While looking to your documentation, I came across hjoly2> the following: hjoly2> hjoly2> "Many graph representations (such as adjacency lists) hjoly2> do not store actual vertex objects, while others do hjoly2> (e.g., pointer-linked graphs)." (c.f. hjoly2> boost-1.30.2/libs/graph/doc/quick_tour.html) hjoly2> hjoly2> Is the pointer-linked graph implementation supplied hjoly2> from boost or do I have to create one and use external hjoly2> adaptation for using it with your library? You can use internal properties with adjacency_list. Also, depending on which parameters you pick for adjacency_list, you'll got pointer-linked out-edge lists (OutEdgeList=listS) or pointer-linked vertex lists (VertexList=listS). Check out the docs here: http://www.boost.org/libs/graph/doc/adjacency_list.html or the BGL book. Cheers, Jeremy ---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 856-1820 ----------------------------------------------------------------------
Hi,
I'm wondering if defining a graph as a
pointer-linked vertex list is compatible with the
subgraph paradigm.
Presumably, an adjacency list having its vertex
descriptor defined as a pointer to a vertex object
would fulfil our needs. But how this technique would
behave when we deal with a subgraph having local
vertex descriptors?
--- Jeremy Siek
hjoly2> Hi, hjoly2> I'd like to know if it's possible to create a BGL hjoly2> graph that uses custom-made classes for the nodes and hjoly2> the edges.
The answer is yes and no.
You can't use your own vertex and edge classes. However, you can tell adjacency_list to store extra stuff of your choosing with each vertex and edge, that is, using internal properties.
hjoly2> While looking to your documentation, I came across hjoly2> the following: hjoly2> hjoly2> "Many graph representations (such as adjacency lists) hjoly2> do not store actual vertex objects, while others do hjoly2> (e.g., pointer-linked graphs)." (c.f. hjoly2> boost-1.30.2/libs/graph/doc/quick_tour.html) hjoly2> hjoly2> Is the pointer-linked graph implementation supplied hjoly2> from boost or do I have to create one and use external hjoly2> adaptation for using it with your library?
You can use internal properties with adjacency_list. Also, depending on which parameters you pick for adjacency_list, you'll got pointer-linked out-edge lists (OutEdgeList=listS) or pointer-linked vertex lists (VertexList=listS). Check out the docs here:
http://www.boost.org/libs/graph/doc/adjacency_list.html
or the BGL book.
Cheers, Jeremy
----------------------------------------------------------------------
Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu 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, On Jan 29, 2004, at 8:36 AM, Hugues Joly wrote:
Hi, I'm wondering if defining a graph as a pointer-linked vertex list is compatible with the subgraph paradigm.
Presumably, an adjacency list having its vertex descriptor defined as a pointer to a vertex object would fulfil our needs. But how this technique would behave when we deal with a subgraph having local vertex descriptors?
Let's see... here's the requirements on the Graph template parameter of subgraph: A graph type modeling VertexMutableGraph and EdgeMutableGraph. Also the graph must have internal vertex_index and edge_index properties. The vertex indices must be maintained automatically by the graph, whereas the edge indices will be assigned by the subgraph class implementation. Ok, so the vertex indices are not automatically maintained in adjacency_list when VertexList=listS, so that won't work. Sorry. (I'm sure it would be possible to change subgraph to lift this restriction, but that of course would take time). -Jeremy ------------------------------------------------------------------------ ----------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 856-1820 ------------------------------------------------------------------------ -----------------
participants (2)
-
Hugues Joly
-
Jeremy Siek