0

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

yamiddu
  • 43
  • 1
  • 6
  • 1
    The adjacency list instance you showed is an undirected graph. What else do you want? โ€“ sehe Mar 19 '15 at 23:49
  • Hi, thanks for the remark, I slightly modified the post. I would use an adjacency_list, but the bron_kerbosch_all_cliques algorithm only works with undirected_graph's. โ€“ yamiddu Mar 20 '15 at 09:20

1 Answers1

1

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 the AdjacencyMatrix, IncidenceGraph concept and the VertexIndexGraph concepts. [ยน Any Graph type that implements the edge() function will satisfy the expression requirements for the AdjacencyMatrix, 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

sehe
  • 328,274
  • 43
  • 416
  • 565
  • Thanks! The default boost version in the cluster I work is 1.41.0 (2009). And I could not get my code to compile. When using the most recent headers it works. โ€“ yamiddu Mar 20 '15 at 10:52