|
Boost Users : |
Subject: Re: [Boost-users] Confused with BGL-- Six Degrees of KevinBaconexample
From: lizy10b (lizy10b_at_[hidden])
Date: 2013-05-30 12:16:26
Dear Jeremiah Willcock,
Thanks for your explanations.
I think I am starting to walk out of the chaos...
For the adjacency+AF8-list, there isn't an edge+AF8-index property.
That means the edge+AF8-index property is not used by the
graph internally, but could be used by user just like the edge+AF8-weight or edge+AF8-name, and these property should be assgined by user manually.
So in the examples +ACI-exterior+AF8-properties.cpp+ACI-, I could replace all the strings +ACI-edge+AF8-index+ACI- with +ACI-edge+AF8-weight+ACI-, and doing this will not affect the result.
The property map works in this case beacuse the edge+AF8-index property is type of int, and the value of the edge+AF8-index property
is the offset to the beginning of the underlying property containers (int capacity+AFsAXQ- and int flow+AFsAXQ-).
And the whole mapping process when calling the +ACI-boost::get(capacity, +ACo-out)+ACI- includes two mappings:
Frist mapping: KEY+AD0AKg-out (edge descriptor)--+AD4-VALUE +AD0- offset value (int)
Second mapping: KEY+AD0-offset value (int) --+AD4- VALUE+AD0- the corresponding property value
Am I right?
Thanks.
Zhiyu LI
+ACI-exterior+AF8-properties.cpp+ACI-:
typedef boost::adjacency+AF8-list+ADw-boost::vecS, boost::vecS,
boost::bidirectionalS, boost::no+AF8-property,
boost::property+ADw-boost::edge+AF8-index+AF8-t, std::size+AF8-t+AD4- +AD4- Graph+ADs-
int capacity+AFsAXQ- +AD0- +AHs- 10, 20, 20, 20, 40, 40, 20, 20, 20, 10 +AH0AOw-
int flow+AFsAXQ- +AD0- +AHs- 8, 12, 12, 12, 12, 12, 16, 16, 16, 8 +AH0AOw-
boost::add+AF8-edge(0, 1, 0, G)+ADs-
boost::add+AF8-edge(1, 4, 1, G)+ADs-
...
typedef boost::property+AF8-map+ADw-Graph, boost::edge+AF8-index+AF8-t+AD4-::type EdgeIndexMap+ADs-
EdgeIndexMap edge+AF8-id +AD0- boost::get(boost::edge+AF8-index, G)+ADs-
boost::iterator+AF8-property+AF8-map +ADw-int+ACo-, EdgeIndexMap, int, int+ACYAPg-
capacity+AF8-array(capacity, edge+AF8-id), flow+AF8-array(flow, edge+AF8-id)+ADs-
print+AF8-network(G, capacity+AF8-array, flow+AF8-array)+ADs-
inside the function print+AF8-network:
boost::get(capacity, +ACo-out) ...
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