bron_kerbosch_clique_number.cpp 1000 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // (C) Copyright Andrew Sutton 2007
  2. //
  3. // Use, modification and distribution are subject to the
  4. // Boost Software License, Version 1.0 (See accompanying file
  5. // LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  6. //[code_bron_kerbosch_clique_number
  7. #include <iostream>
  8. #ifdef _MSC_VER
  9. #define _CRT_SECURE_NO_WARNINGS
  10. #endif
  11. #include <boost/graph/undirected_graph.hpp>
  12. #include <boost/graph/bron_kerbosch_all_cliques.hpp>
  13. #include "helper.hpp"
  14. using namespace std;
  15. using namespace boost;
  16. // Declare the graph type and its vertex and edge types.
  17. typedef undirected_graph<> Graph;
  18. typedef graph_traits<Graph>::vertex_descriptor Vertex;
  19. typedef graph_traits<Graph>::edge_descriptor Edge;
  20. int
  21. main(int argc, char *argv[])
  22. {
  23. // Create the graph and read it from standard input.
  24. Graph g;
  25. read_graph(g, cin);
  26. // Use the Bron-Kerbosch algorithm to find all cliques, and
  27. size_t c = bron_kerbosch_clique_number(g);
  28. cout << "clique number: " << c << endl;
  29. return 0;
  30. }
  31. //]