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 7 //[tiernan_girth_circumference 8 #include <iostream> 9 10 #include <boost/graph/directed_graph.hpp> 11 #include <boost/graph/tiernan_all_cycles.hpp> 12 13 #include "helper.hpp" 14 15 using namespace std; 16 using namespace boost; 17 18 // Declare the graph type and its vertex and edge types. 19 typedef directed_graph<> Graph; 20 typedef graph_traits< Graph >::vertex_descriptor Vertex; 21 typedef graph_traits< Graph >::edge_descriptor Edge; 22 main(int argc,char * argv[])23int main(int argc, char* argv[]) 24 { 25 // Create the graph and read it from standard input. 26 Graph g; 27 read_graph(g, cin); 28 29 // Compute the girth and circumference simulataneously 30 size_t girth, circ; 31 boost::tie(girth, circ) = tiernan_girth_and_circumference(g); 32 33 // Print the result 34 cout << "girth: " << girth << endl; 35 cout << "circumference: " << circ << endl; 36 37 return 0; 38 } 39 //] 40