Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Graph: edge indices
From: Trevor Harmon (Trevor.W.Harmon_at_[hidden])
Date: 2010-04-01 14:55:40


On Apr 1, 2010, at 6:40 AM, Jeremiah Willcock wrote:

> Note that you need to fill in the edge indices

Okay, so whenever I add an edge I need to assign it a unique index
myself. Here's how I'm doing it for the initial construction of the
graph:

size_t edgeIndex = 0;
for (...) {
    Vertex u = ...
    Vertex v = ...
    Edge edge;
    bool inserted;
    tie(edge, inserted) = add_edge(u, v, g);
    EdgeIndexMap edgeIndexMap = get(edge_index, g);
    put(edgeIndexMap, edge, edgeIndex++);
}

Does that look right? It seems to work, but I'm wondering if it's the
best way.

Trevor


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net