Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What do you mean, you can't subclass out vertices? You can use your own vertex class, it's just a matter of specifying it in the Graph typedef. You can even use members as properties when working with BGL algorithms.</p> <p>As for the other way around (which is harder IMO), you need to create a vertex property list and access it using a vertex descriptor... I think.</p> <p>Edit: You specify vertex/edge classes when defining your graph type:</p> <pre><code>struct Vertex { double some_property; }; struct Edge { double weight; }; typedef boost::adjacency_list&lt; boost::listS, boost::vecS, boost::undirectedS, Vertex, Edge &gt; Graph; //sorry about the formatting Graph g; </code></pre> <p>From where on g[vertex_descriptor] should return a reference to Vertex, e.g.:</p> <pre><code>//add 100 vertices for (int i=0; i&lt;100; ++i) { Graph::vertex_descriptor v = add_vertex(g); g[v].some_property = -1.0; } //zero some_property for all vertices for (Graph::vertex_iterator i = vertices(g).first; i != vertices(g).second; ++i) { g[*i].some_property = 0.0; } </code></pre> <p>I couldn't find my visitor code making use of these properties but I did find the relevant part of the BGL documentation:</p> <p>1) The part about <a href="http://www.boost.org/doc/libs/1_39_0/libs/graph/doc/using_adjacency_list.html#sec:adjacency-list-properties" rel="noreferrer">Internal Properties</a>, which recommends you use instead:<br> 2) <a href="http://www.boost.org/doc/libs/1_39_0/libs/graph/doc/bundles.html" rel="noreferrer">Bundled Properties</a></p> <p>The second link seems to have a Boost function making use of bundled properties using a member pointer.</p> <p>Does this help?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload