Reputation: 43
is it possible to fix the type of the vertices in a boost::undirected_graph
such to be, e.g., 'int'?
The 'int' vertex type seems to be the default with the boost::adjacency_list
, and the following code works:
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS> g;
boost::add_edge(0 , 1 , g);
but fails with an undirected_graph. What additional steps should I do to use the same syntax for adding vertices to an undirected_graph?
I need to use a bron_kerbosch_all_cliques
algorithm which only accepts undirected_graph as input.
thanks
Upvotes: 0
Views: 199
Reputation: 392929
I need to use a bron_kerbosch_all_cliques algorithm which only accepts undirected_graph as input.
The source tells me it accepts generic graphs (as BGL does):
The docs are hard to find (might be a bug in the quickbook definitions?), but here goes:
Requirements: The
Graph
type must be a model of theAdjacencyMatrix
,IncidenceGraph
concept and theVertexIndexGraph
concepts. [¹ AnyGraph
type that implements theedge()
function will satisfy the expression requirements for theAdjacencyMatrix
, but may incur additional overhead due non-constant time complexity.].
Head over to Concepts page in BGL documentation to see which graph types fit the bill.
I see that the likely "missing link" is the VertexIndexGraph concept. You can likely achieve this by adding a vertex_index_t
Interior Property
Upvotes: 1