Note that there are some explanatory texts on larger screens.

plurals
  1. POadjacency_list with VertexList different from vecS
    primarykey
    data
    text
    <p>I have two structs containing some fields: struct MyNodeData, and struct MyEdgeData. When I create a graph with VertexList as vecS, there is no problem to access the descriptor of vertices etc. For example:</p> <pre><code>typedef adjacency_list&lt;setS, vecS, undirectedS, MyNodeData, MyEdgeData&gt; Graph; typedef Graph::vertex_descriptor MyNodeDataID; typedef Graph::edge_descriptor MyEdgeDataID; typedef graph_traits &lt; Graph &gt;::vertex_iterator VertexIterator; typedef graph_traits &lt; Graph &gt;::edge_iterator EdgeIterator; typedef graph_traits &lt; Graph &gt;::adjacency_iterator AdjacencyIterator; typedef property_map &lt; Graph, vertex_index_t &gt;::type IndexMap; Graph g; const IndexMap index = get(vertex_index, g); /* Puis après avoir ajouté des vertex et edges, je peux accéder par exemple à la liste des vertex comme suite: */ pair&lt;VertexIterator, VertexIterator&gt; vi; for(vi = vertices(g); vi.first != vi.second; ++vi.first) { cout &lt;&lt; "vertex: " &lt;&lt; index[*vi.first] &lt;&lt; endl; // or: cout &lt;&lt; "vertex: " &lt;&lt; *vi.first &lt;&lt; endl; } </code></pre> <p>But I usually need to add/delete edges and vertices from my graph. So I want to use setS or listS as a VertexList, instead of vecS, since with vecS the indexes are invalidated when we delete one of them ! The problem is that if I define VertexList as setS or listS, I can not browse the list of vertices/edges and access there descriptors like I did before !</p> <p>To make it short, my question is: Since an adjacency_list that uses listS or setS as the vertex container does not automatically provide this vertex_id property, how can I add it to the code above ?</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. 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