Dear Jeremiah Willcock,
Thanks for your explanations.
I think I am starting to
walk out of the chaos...
For the adjacency_list, there isn't an edge_index property.
That means the edge_index property is not used by the
graph internally, but could be used by user just like the edge_weight or edge_name,
and these property should be assgined by user manually.
So in the examples "exterior_properties.cpp", I could replace all the strings "edge_index" with "edge_weight", and
doing this will not affect the result.
The property map works in this case
beacuse the edge_index property is type of int, and the value of the edge_index property
is the offset to the beginning of the underlying property containers (int capacity[] and int flow[]).
And the whole mapping process when calling the "boost::get(capacity, *out)" includes two mappings:
Frist mapping: KEY=*out (edge descriptor)-->VALUE = offset value (int)
Second mapping: KEY=offset value (int) --> VALUE= the corresponding property value
Am I right?
Thanks.
Zhiyu LI
"exterior_properties.cpp":
typedef boost::adjacency_list<boost::vecS, boost::vecS,
boost::bidirectionalS, boost::no_property,
boost::property<boost::edge_index_t, std::size_t> > Graph;
int capacity[] = { 10, 20, 20, 20, 40, 40, 20, 20, 20, 10 };
int flow[] = { 8, 12, 12, 12, 12, 12, 16, 16, 16, 8 };
boost::add_edge(0, 1, 0, G);
boost::add_edge(1, 4, 1, G);
...
typedef boost::property_map<Graph, boost::edge_index_t>::type EdgeIndexMap;
EdgeIndexMap edge_id = boost::get(boost::edge_index, G);
boost::iterator_property_map <int*, EdgeIndexMap, int, int&>
capacity_array(capacity, edge_id), flow_array(flow, edge_id);
print_network(G, capacity_array, flow_array);
inside the function print_network:
boost::get(capacity, *out) ...