About questions in the comments:
- According to the comment in the source code of the VC ++ example, there are some problems with the specified parameter mechanism . Therefore, I would suggest that both branches basically also think that the version of VC ++ is simply more complex (I did not dive into it long enough to be 100% sure, though).
- A
property_map
maps vertices / edges to additional data associated with a particular vertex / edge. For instance. weightmap
in the example associates the weight (travel cost) with each edge. predecessor_map
used to record paths for all vertices (for each vertex, the predecessor is written on the path from the root). As for why this is needed: itβs good that information is something that often hopes to exit the algorithm.
The parameters are clearly listed in the description . Pay attention to two versions: one with named parameters and one without (later used in VC ++).
now a few step-by-step code of the example provided in the documentation (note that I never used Boost.Graph, so this does not guarantee correctness, I also included only the relevant parts and skipped #if
for VC ++):
const int num_nodes = 5;
As I mentioned in the comments, I find lemon more intuitive to use then Boost.Graph, so you might want to take a look instead
source share