1 | // Copyright (C) 2004-2008 The Trustees of Indiana University. |
---|---|
2 | |
3 | // Use, modification and distribution is subject to the Boost Software |
4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
5 | // http://www.boost.org/LICENSE_1_0.txt) |
6 | |
7 | #include <boost/graph/breadth_first_search.hpp> |
8 | #include <boost/graph/adjacency_list.hpp> |
9 | #include <boost/graph/metis.hpp> |
10 | #include <fstream> |
11 | |
12 | #ifdef BOOST_NO_EXCEPTIONS |
13 | void boost::throw_exception(std::exception const& ex) |
14 | { |
15 | std::cout << ex.what() << std::endl; |
16 | abort(); |
17 | } |
18 | #endif |
19 | |
20 | using namespace boost; |
21 | |
22 | /* An undirected graph with distance values stored on the vertices. */ |
23 | typedef adjacency_list< vecS, vecS, undirectedS, |
24 | property< vertex_distance_t, std::size_t > > |
25 | Graph; |
26 | |
27 | int main(int argc, char* argv[]) |
28 | { |
29 | // Parse command-line options |
30 | const char* filename = "weighted_graph.gr"; |
31 | if (argc > 1) |
32 | filename = argv[1]; |
33 | |
34 | // Open the METIS input file |
35 | std::ifstream in(filename); |
36 | assert(in.good()); |
37 | graph::metis_reader reader(in); |
38 | |
39 | // Load the graph using the default distribution |
40 | Graph g(reader.begin(), reader.end(), reader.num_vertices()); |
41 | |
42 | return 0; |
43 | } |
44 |