I started using the BGL for some graph-related task. I have a large number of edges and each edge has several properties, one of which is its weight. (All properties are floats and ints). Since I never worked with the BGL (and/or similar CPP libraries) before, I'm a bit lost with all these types, classes and how to use it properly.
I add my edges like this:
struct EdgeProperty
{
int weight;
float e1;
float e2;
};
typedef adjacency_list<vecS, vecS, bidirectionalS, no_property, EdgeProperty> Graph;
...
EdgeProperty prop;
node1 = ...;
node2 = ...;
prop.e1 = ...;
prop.e2 = ...;
prop.weight = ...;
add_edge(node1, node2, prop, g);
Then, I need to access my property later, what I am trying to do like this:
property_map<Graph, EdgeProperty>::type EdgeWeightMap = get(EdgeProperty, g);
w = get(EdgeWeightMap,some_edge);
However, this doesn't even compile. It says in the error message:
error: no type named ‘kind’ in ‘struct EdgeProperty’
amongst other errors, which I consider less important right now. I don't know if this is how you would use custom properties. Could you please explain to me the kind
error message and how to use custom properties? I couldn't find any documentation (which I understand) on this topic.