diff --git a/.clang-format b/.clang-format
index e73f6d56..81a8918f 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,6 +5,7 @@ AlignEscapedNewlinesLeft: true
AlwaysBreakAfterDefinitionReturnType: None
BreakBeforeBraces: Allman
BreakConstructorInitializersBeforeComma: false
+BreakTemplateDeclarations: Yes
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 0
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e4505d4d..fef3d356 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -176,3 +176,227 @@ jobs:
- name: Test
run: ..\..\..\b2 --hash address-model=64 cxxstd=14,17,20 toolset=msvc-14.3
working-directory: ../boost-root/libs/graph/test
+
+ posix-cmake-subdir:
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - os: ubuntu-20.04
+ - os: ubuntu-22.04
+ - os: ubuntu-24.04
+ - os: macos-13
+ - os: macos-14
+ - os: macos-15
+
+ runs-on: ${{matrix.os}}
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install packages
+ if: matrix.install
+ run: sudo apt-get -y install ${{matrix.install}}
+
+ - name: Setup Boost
+ run: |
+ echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
+ LIBRARY=${GITHUB_REPOSITORY#*/}
+ echo LIBRARY: $LIBRARY
+ echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
+ echo GITHUB_BASE_REF: $GITHUB_BASE_REF
+ echo GITHUB_REF: $GITHUB_REF
+ REF=${GITHUB_BASE_REF:-$GITHUB_REF}
+ REF=${REF#refs/heads/}
+ echo REF: $REF
+ BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
+ echo BOOST_BRANCH: $BOOST_BRANCH
+ cd ..
+ git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
+ cd boost-root
+ cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
+ git submodule update --init tools/boostdep
+ python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
+
+ - name: Use library with add_subdirectory
+ run: |
+ cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test
+ mkdir __build__ && cd __build__
+ cmake ..
+ cmake --build .
+ ctest --output-on-failure --no-tests=error
+
+ posix-cmake-install:
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - os: ubuntu-20.04
+ - os: ubuntu-22.04
+ - os: ubuntu-24.04
+ - os: macos-13
+ - os: macos-14
+ - os: macos-15
+
+ runs-on: ${{matrix.os}}
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install packages
+ if: matrix.install
+ run: sudo apt-get -y install ${{matrix.install}}
+
+ - name: Setup Boost
+ run: |
+ echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
+ LIBRARY=${GITHUB_REPOSITORY#*/}
+ echo LIBRARY: $LIBRARY
+ echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
+ echo GITHUB_BASE_REF: $GITHUB_BASE_REF
+ echo GITHUB_REF: $GITHUB_REF
+ REF=${GITHUB_BASE_REF:-$GITHUB_REF}
+ REF=${REF#refs/heads/}
+ echo REF: $REF
+ BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
+ echo BOOST_BRANCH: $BOOST_BRANCH
+ cd ..
+ git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
+ cd boost-root
+ cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
+ git submodule update --init tools/boostdep
+ python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
+
+ - name: Configure
+ run: |
+ cd ../boost-root
+ mkdir __build__ && cd __build__
+ cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
+
+ - name: Install
+ run: |
+ cd ../boost-root/__build__
+ cmake --build . --target install
+
+ - name: Use the installed library
+ run: |
+ cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
+ cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
+ cmake --build .
+ ctest --output-on-failure --no-tests=error
+
+ windows-cmake-subdir:
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - os: windows-2019
+ - os: windows-2022
+
+ runs-on: ${{matrix.os}}
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup Boost
+ shell: cmd
+ run: |
+ echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
+ for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
+ echo LIBRARY: %LIBRARY%
+ echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
+ echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
+ echo GITHUB_REF: %GITHUB_REF%
+ if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
+ set BOOST_BRANCH=develop
+ for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
+ echo BOOST_BRANCH: %BOOST_BRANCH%
+ cd ..
+ git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
+ cd boost-root
+ xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
+ git submodule update --init tools/boostdep
+ python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
+
+ - name: Use library with add_subdirectory (Debug)
+ shell: cmd
+ run: |
+ cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test
+ mkdir __build__ && cd __build__
+ cmake ..
+ cmake --build . --config Debug
+ ctest --output-on-failure --no-tests=error -C Debug
+
+ - name: Use library with add_subdirectory (Release)
+ shell: cmd
+ run: |
+ cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test/__build__
+ cmake --build . --config Release
+ ctest --output-on-failure --no-tests=error -C Release
+
+ windows-cmake-install:
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - os: windows-2019
+ - os: windows-2022
+
+ runs-on: ${{matrix.os}}
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup Boost
+ shell: cmd
+ run: |
+ echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
+ for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
+ echo LIBRARY: %LIBRARY%
+ echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
+ echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
+ echo GITHUB_REF: %GITHUB_REF%
+ if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
+ set BOOST_BRANCH=develop
+ for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
+ echo BOOST_BRANCH: %BOOST_BRANCH%
+ cd ..
+ git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
+ cd boost-root
+ xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
+ git submodule update --init tools/boostdep
+ python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
+
+ - name: Configure
+ shell: cmd
+ run: |
+ cd ../boost-root
+ mkdir __build__ && cd __build__
+ cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
+
+ - name: Install (Debug)
+ shell: cmd
+ run: |
+ cd ../boost-root/__build__
+ cmake --build . --target install --config Debug
+
+ - name: Install (Release)
+ shell: cmd
+ run: |
+ cd ../boost-root/__build__
+ cmake --build . --target install --config Release
+
+ - name: Use the installed library (Debug)
+ shell: cmd
+ run: |
+ cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
+ cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
+ cmake --build . --config Debug
+ ctest --output-on-failure --no-tests=error -C Debug
+
+ - name: Use the installed library (Release)
+ shell: cmd
+ run: |
+ cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test/__build__
+ cmake --build . --config Release
+ ctest --output-on-failure --no-tests=error -C Release
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0e294eb5..73ba0407 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,7 +22,6 @@ target_link_libraries(boost_graph
Boost::array
Boost::assert
Boost::bimap
- Boost::bind
Boost::concept_check
Boost::config
Boost::container_hash
diff --git a/README.md b/README.md
index 9fab5205..1114cbd4 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-Boost Graph Library [](https://drone.cpp.al/boostorg/graph)[](https://github.com/boostorg/graph/actions)
+# Boost Graph Library
===================
@@ -6,7 +6,7 @@ A generic interface for traversing graphs, using C++ templates.
The full documentation is available on [boost.org](http://www.boost.org/doc/libs/release/libs/graph/doc/index.html).
-## Support, bugs and feature requests ##
+## Support, bugs and feature requests
Bugs and feature requests can be reported through the [Github issue page](https://github.com/boostorg/graph/issues).
@@ -22,13 +22,15 @@ You can submit your changes through a [pull request](https://github.com/boostorg
There is no mailing-list specific to Boost Graph, although you can use the general-purpose Boost [mailing-list](http://lists.boost.org/mailman/listinfo.cgi/boost-users) using the tag [graph].
-## Development ##
+### Build Status
| | Master | Develop |
|------------------|----------|-------------|
-| Github Actions | [](https://github.com/boostorg/graph/actions) | [](https://github.com/boostorg/graph/actions) |
+| Github Actions | [](https://github.com/boostorg/graph/actions) | [](https://github.com/boostorg/graph/actions) |
|Drone | [](https://drone.cpp.al/boostorg/graph) | [](https:/drone.cpp.al/boostorg/graph) |
+## Development
+
Clone the whole boost project, which includes the individual Boost projects as submodules ([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)):
git clone https://github.com/boostorg/boost
@@ -45,7 +47,7 @@ Boost Graph Library is mostly made of headers but also contains some compiled co
**Note:** The Boost Graph Library cannot currently be built outside of Boost itself.
-### Running tests ###
+### Running tests
First, make sure you are in `libs/graph/test`.
You can either run all the 300+ tests listed in `Jamfile.v2` or run a single test:
diff --git a/doc/bibliography.html b/doc/bibliography.html
index b541abf6..e79333f5 100644
--- a/doc/bibliography.html
+++ b/doc/bibliography.html
@@ -453,6 +453,11 @@ Journal of the ACM (JACM), 23(2): 221-234, 1976.
Data Structures for Weighted Matching and Nearest Common Ancestors with Linking
Proceedings of the First Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 434-443, 1990.
+
77
+Zvi Galil
+Efficient Algorithms for Finding Maximum Matching in Graphs
+ACM Computing Surveys (CSUR), 18(1), 23-38, 1986.
+
diff --git a/doc/grid_graph.html b/doc/grid_graph.html
index 261dd57c..053ad115 100644
--- a/doc/grid_graph.html
+++ b/doc/grid_graph.html
@@ -69,7 +69,7 @@
Defined in
boost/graph/grid_graph.hpp
- with all functions in the boost namespace. A simple examples of creating and iterating over a grid_graph is available here libs/graph/example/grid_graph_example.cpp. An example of adding properties to a grid_graph is also available libs/graph/example/grid_graph_properties.cpp
+ with all functions in the boost namespace. A simple examples of creating and iterating over a grid_graph is available here libs/graph/example/grid_graph_example.cpp. An example of adding properties to a grid_graph is also available libs/graph/example/grid_graph_properties.cpp
Template Parameters
diff --git a/doc/maximum_weighted_matching.html b/doc/maximum_weighted_matching.html
index ab40f1f4..ca3f221a 100644
--- a/doc/maximum_weighted_matching.html
+++ b/doc/maximum_weighted_matching.html
@@ -1,5 +1,6 @@
" << target(*ei, g)
<< " with weight of " << weight[*ei] << std::endl;
diff --git a/example/kruskal-telephone.cpp b/example/kruskal-telephone.cpp
index c88337c5..e4a48ab9 100644
--- a/example/kruskal-telephone.cpp
+++ b/example/kruskal-telephone.cpp
@@ -30,8 +30,7 @@ int main()
property< edge_weight_t, int > >
Graph;
Graph g(num_vertices(g_dot));
- property_map< GraphvizGraph, edge_attribute_t >::type edge_attr_map
- = get(edge_attribute, g_dot);
+ auto edge_attr_map = get(edge_attribute, g_dot);
graph_traits< GraphvizGraph >::edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = edges(g_dot); ei != ei_end; ++ei)
{
@@ -45,22 +44,20 @@ int main()
size_type;
kruskal_minimum_spanning_tree(g, std::back_inserter(mst));
- property_map< Graph, edge_weight_t >::type weight = get(edge_weight, g);
+ auto weight = get(edge_weight, g);
int total_weight = 0;
- for (size_type e = 0; e < mst.size(); ++e)
- total_weight += get(weight, mst[e]);
+ for (auto const& edge : mst)
+ total_weight += get(weight, edge);
std::cout << "total weight: " << total_weight << std::endl;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
- for (size_type i = 0; i < mst.size(); ++i)
+ for (auto const& edge : mst)
{
- Vertex u = source(mst[i], g), v = target(mst[i], g);
+ auto u = source(edge, g), v = target(edge, g);
edge_attr_map[edge(u, v, g_dot).first]["color"] = "black";
}
std::ofstream out("figs/telephone-mst-kruskal.dot");
- graph_property< GraphvizGraph, graph_edge_attribute_t >::type&
- graph_edge_attr_map
- = get_property(g_dot, graph_edge_attribute);
+ auto graph_edge_attr_map = get_property(g_dot, graph_edge_attribute);
graph_edge_attr_map["color"] = "gray";
graph_edge_attr_map["style"] = "bold";
write_graphviz(out, g_dot);
diff --git a/example/kuratowski_subgraph.cpp b/example/kuratowski_subgraph.cpp
index e9779e63..3ce3f269 100644
--- a/example/kuratowski_subgraph.cpp
+++ b/example/kuratowski_subgraph.cpp
@@ -45,7 +45,7 @@ int main(int argc, char** argv)
add_edge(4, 5, g);
// Initialize the interior edge index
- property_map< graph, edge_index_t >::type e_index = get(edge_index, g);
+ auto e_index = get(edge_index, g);
graph_traits< graph >::edges_size_type edge_count = 0;
graph_traits< graph >::edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
diff --git a/example/last-mod-time.cpp b/example/last-mod-time.cpp
index 7d8676eb..7001fe4e 100644
--- a/example/last-mod-time.cpp
+++ b/example/last-mod-time.cpp
@@ -76,8 +76,7 @@ int main(int argc, const char** argv)
exit(-1);
}
// Obtain internal property map from the graph
- property_map< graph_type, vertex_name_t >::type name_map
- = get(vertex_name, g);
+ auto name_map = get(vertex_name, g);
read_graph_file(file_in, name_in, g, name_map);
// Create storage for last modified times
@@ -89,7 +88,7 @@ int main(int argc, const char** argv)
// Create last modified time property map
iter_map_t mod_time_map(last_mod_vec.begin(), get(vertex_index, g));
- property_map< graph_type, vertex_name_t >::type name = get(vertex_name, g);
+ auto name = get(vertex_name, g);
struct stat stat_buf;
graph_traits< graph_type >::vertex_descriptor u;
typedef graph_traits< graph_type >::vertex_iterator vertex_iter_t;
diff --git a/example/leda-graph-eg.cpp b/example/leda-graph-eg.cpp
index 507498ec..008349d9 100644
--- a/example/leda-graph-eg.cpp
+++ b/example/leda-graph-eg.cpp
@@ -19,7 +19,7 @@ int main()
g.new_node("Eurystheus");
g.new_node("Amphitryon");
typedef property_map< graph_t, vertex_all_t >::type NodeMap;
- NodeMap node_name_map = get(vertex_all, g);
+ auto node_name_map = get(vertex_all, g);
graph_traits< graph_t >::vertex_iterator vi, vi_end;
for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
std::cout << node_name_map[*vi] << std::endl;
diff --git a/example/loops_dfs.cpp b/example/loops_dfs.cpp
index b56dd83a..e080307b 100644
--- a/example/loops_dfs.cpp
+++ b/example/loops_dfs.cpp
@@ -133,20 +133,18 @@ int main(int argc, char* argv[])
typedef std::set< Vertex > set_t;
typedef std::list< set_t > list_of_sets_t;
list_of_sets_t loops;
- Vertex entry = *vertices(g).first;
+ auto entry = *vertices(g).first;
find_loops(entry, g, loops);
- property_map< Graph, vertex_attribute_t >::type vattr_map
- = get(vertex_attribute, g);
- property_map< Graph, edge_attribute_t >::type eattr_map
- = get(edge_attribute, g);
+ auto vattr_map = get(vertex_attribute, g);
+ auto eattr_map = get(edge_attribute, g);
graph_traits< Graph >::edge_iterator ei, ei_end;
- for (list_of_sets_t::iterator i = loops.begin(); i != loops.end(); ++i)
+ for (auto i = loops.begin(); i != loops.end(); ++i)
{
std::vector< bool > in_loop(num_vertices(g), false);
- for (set_t::iterator j = (*i).begin(); j != (*i).end(); ++j)
+ for (auto j = (*i).begin(); j != (*i).end(); ++j)
{
vattr_map[*j]["color"] = "gray";
in_loop[*j] = true;
@@ -167,9 +165,7 @@ int main(int argc, char* argv[])
for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
{
loops_out << *vi << "[";
- for (std::map< std::string, std::string >::iterator ai
- = vattr_map[*vi].begin();
- ai != vattr_map[*vi].end(); ++ai)
+ for (auto ai = vattr_map[*vi].begin(); ai != vattr_map[*vi].end(); ++ai)
{
loops_out << ai->first << "=" << ai->second;
if (next(ai) != vattr_map[*vi].end())
@@ -181,10 +177,8 @@ int main(int argc, char* argv[])
for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
{
loops_out << source(*ei, g) << " -> " << target(*ei, g) << "[";
- std::map< std::string, std::string >& attr_map = eattr_map[*ei];
- for (std::map< std::string, std::string >::iterator eai
- = attr_map.begin();
- eai != attr_map.end(); ++eai)
+ auto& attr_map = eattr_map[*ei];
+ for (auto eai = attr_map.begin(); eai != attr_map.end(); ++eai)
{
loops_out << eai->first << "=" << eai->second;
if (next(eai) != attr_map.end())
diff --git a/example/make_biconnected_planar.cpp b/example/make_biconnected_planar.cpp
index f9c101a7..bf9a1d18 100644
--- a/example/make_biconnected_planar.cpp
+++ b/example/make_biconnected_planar.cpp
@@ -41,7 +41,7 @@ int main(int argc, char** argv)
add_edge(0, 10, g);
// Initialize the interior edge index
- property_map< graph, edge_index_t >::type e_index = get(edge_index, g);
+ auto e_index = get(edge_index, g);
graph_traits< graph >::edges_size_type edge_count = 0;
graph_traits< graph >::edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
diff --git a/example/make_maximal_planar.cpp b/example/make_maximal_planar.cpp
index 4647f1c0..92b1294d 100644
--- a/example/make_maximal_planar.cpp
+++ b/example/make_maximal_planar.cpp
@@ -60,7 +60,7 @@ int main(int argc, char** argv)
<< 2 * num_vertices(g) - 4 << " faces." << std::endl;
// Initialize the interior edge index
- property_map< graph, edge_index_t >::type e_index = get(edge_index, g);
+ auto e_index = get(edge_index, g);
graph_traits< graph >::edges_size_type edge_count = 0;
graph_traits< graph >::edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
diff --git a/example/matching_example.cpp b/example/matching_example.cpp
index 3c8a4fbb..39c9b7cd 100644
--- a/example/matching_example.cpp
+++ b/example/matching_example.cpp
@@ -25,15 +25,14 @@ int main()
const int n_vertices = 18;
- std::vector< std::string > ascii_graph;
-
- ascii_graph.push_back(" 0 1---2 3 ");
- ascii_graph.push_back(" \\ / \\ / ");
- ascii_graph.push_back(" 4---5 6---7 ");
- ascii_graph.push_back(" | | | | ");
- ascii_graph.push_back(" 8---9 10---11 ");
- ascii_graph.push_back(" / \\ / \\ ");
- ascii_graph.push_back(" 12 13 14---15 16 17 ");
+ std::vector< std::string > ascii_graph
+ = { " 0 1---2 3 ",
+ " \\ / \\ / ",
+ " 4---5 6---7 ",
+ " | | | | ",
+ " 8---9 10---11 ",
+ " / \\ / \\ ",
+ " 12 13 14---15 16 17 " };
// It has a perfect matching of size 8. There are two isolated
// vertices that we'll use later...
@@ -75,9 +74,8 @@ int main()
std::cout << "In the following graph:" << std::endl << std::endl;
- for (std::vector< std::string >::iterator itr = ascii_graph.begin();
- itr != ascii_graph.end(); ++itr)
- std::cout << *itr << std::endl;
+ for (auto const& str : ascii_graph)
+ std::cout << str << std::endl;
std::cout << std::endl
<< "Found a matching of size " << matching_size(g, &mate[0])
@@ -106,8 +104,7 @@ int main()
std::cout << "In the following graph:" << std::endl << std::endl;
- for (std::vector< std::string >::iterator itr = ascii_graph.begin();
- itr != ascii_graph.end(); ++itr)
+ for (auto itr = ascii_graph.begin(); itr != ascii_graph.end(); ++itr)
std::cout << *itr << std::endl;
std::cout << std::endl
diff --git a/example/max_flow.cpp b/example/max_flow.cpp
index 17035688..ca7eed5e 100644
--- a/example/max_flow.cpp
+++ b/example/max_flow.cpp
@@ -62,11 +62,9 @@ int main()
Graph g;
- property_map< Graph, edge_capacity_t >::type capacity
- = get(edge_capacity, g);
- property_map< Graph, edge_reverse_t >::type rev = get(edge_reverse, g);
- property_map< Graph, edge_residual_capacity_t >::type residual_capacity
- = get(edge_residual_capacity, g);
+ auto capacity = get(edge_capacity, g);
+ auto rev = get(edge_reverse, g);
+ auto residual_capacity = get(edge_residual_capacity, g);
Traits::vertex_descriptor s, t;
read_dimacs_max_flow(g, capacity, rev, s, t);
diff --git a/example/mcgregor_subgraphs_example.cpp b/example/mcgregor_subgraphs_example.cpp
index f0b74fc9..287a47a9 100644
--- a/example/mcgregor_subgraphs_example.cpp
+++ b/example/mcgregor_subgraphs_example.cpp
@@ -81,14 +81,12 @@ int main(int argc, char* argv[])
property< edge_name_t, unsigned int > >
Graph;
- typedef property_map< Graph, vertex_name_t >::type VertexNameMap;
-
// Test maximum and unique variants on known graphs
Graph graph_simple1, graph_simple2;
example_callback< Graph > user_callback(graph_simple1);
- VertexNameMap vname_map_simple1 = get(vertex_name, graph_simple1);
- VertexNameMap vname_map_simple2 = get(vertex_name, graph_simple2);
+ auto vname_map_simple1 = get(vertex_name, graph_simple1);
+ auto vname_map_simple2 = get(vertex_name, graph_simple2);
// Graph that looks like a triangle
put(vname_map_simple1, add_vertex(graph_simple1), 1);
diff --git a/example/mean_geodesic.cpp b/example/mean_geodesic.cpp
index d0cfee82..7b41bb3d 100644
--- a/example/mean_geodesic.cpp
+++ b/example/mean_geodesic.cpp
@@ -71,7 +71,7 @@ int main(int argc, char* argv[])
// so-called small-world distance) as a result.
GeodesicContainer geodesics(num_vertices(g));
GeodesicMap gm(geodesics, g);
- float sw = all_mean_geodesics(g, dm, gm);
+ auto sw = all_mean_geodesics(g, dm, gm);
// Print the mean geodesic distance of each vertex and finally,
// the graph itself.
diff --git a/example/miles_span.cpp b/example/miles_span.cpp
index d09c7f6f..66d7cb9a 100644
--- a/example/miles_span.cpp
+++ b/example/miles_span.cpp
@@ -102,11 +102,9 @@ int main(int argc, char* argv[])
long sp_length = 0;
// Use the "z" utility field for distance.
- typedef property_map< Graph*, z_property< long > >::type Distance;
- Distance d = get(z_property< long >(), g);
+ auto d = get(z_property< long >(), g);
// Use the "w" property for parent
- typedef property_map< Graph*, w_property< Vertex* > >::type Parent;
- Parent p = get(w_property< Vertex* >(), g);
+ auto p = get(w_property< Vertex* >(), g);
total_length_visitor< Distance > length_vis(sp_length, d);
prim_minimum_spanning_tree(g, p,
diff --git a/example/min_max_paths.cpp b/example/min_max_paths.cpp
index fabf4c94..a35bc4cc 100644
--- a/example/min_max_paths.cpp
+++ b/example/min_max_paths.cpp
@@ -52,14 +52,14 @@ int main(int, char*[])
const char name[] = "abcdef";
const int num_nodes = 6;
- E edges[] = { E(0, 2), E(1, 1), E(1, 3), E(1, 4), E(2, 1), E(2, 3), E(3, 4),
- E(4, 0), E(4, 1) };
+ const auto edges = { E(0, 2), E(1, 1), E(1, 3), E(1, 4), E(2, 1), E(2, 3),
+ E(3, 4), E(4, 0), E(4, 1) };
int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1 };
const int n_edges = sizeof(edges) / sizeof(E);
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
// VC++ can't handle iterator constructors
Graph G(num_nodes);
- property_map< Graph, edge_weight_t >::type weightmap = get(edge_weight, G);
+ auto weightmap = get(edge_weight, G);
for (std::size_t j = 0; j < sizeof(edges) / sizeof(E); ++j)
{
graph_traits< Graph >::edge_descriptor e;
@@ -68,8 +68,8 @@ int main(int, char*[])
weightmap[e] = weights[j];
}
#else
- Graph G(edges, edges + n_edges, weights, num_nodes);
- property_map< Graph, edge_weight_t >::type weightmap = get(edge_weight, G);
+ Graph G(std::begin(edges), std::end(edges), weights, num_nodes);
+ auto = get(edge_weight, G);
#endif
std::vector< Vertex > p(num_vertices(G));
diff --git a/example/minimum_degree_ordering.cpp b/example/minimum_degree_ordering.cpp
index c096ccf6..38044a16 100644
--- a/example/minimum_degree_ordering.cpp
+++ b/example/minimum_degree_ordering.cpp
@@ -146,8 +146,7 @@ int main(int argc, char* argv[])
Vector supernode_sizes(n, 1); // init has to be 1
- boost::property_map< Graph, vertex_index_t >::type id
- = get(vertex_index, G);
+ auto id = get(vertex_index, G);
Vector degree(n, 0);
diff --git a/example/modify_graph.cpp b/example/modify_graph.cpp
index 9c8836e0..acad2c47 100644
--- a/example/modify_graph.cpp
+++ b/example/modify_graph.cpp
@@ -47,8 +47,7 @@ template < class MutableGraph > void modify_demo(MutableGraph& g)
typename GraphTraits::edges_size_type m = 0;
typename GraphTraits::vertex_descriptor u, v, w;
edge_descriptor e, e1, e2;
- typename property_map< MutableGraph, edge_name_t >::type name_map
- = get(edge_name, g);
+ auto name_map = get(edge_name, g);
bool added;
typename GraphTraits::vertex_iterator vi, vi_end;
diff --git a/example/neighbor_bfs.cpp b/example/neighbor_bfs.cpp
index 2beb4b6e..ca3e2d76 100644
--- a/example/neighbor_bfs.cpp
+++ b/example/neighbor_bfs.cpp
@@ -65,16 +65,14 @@ public:
template < class Edge, class Graph >
void tree_out_edge(Edge e, const Graph& g) const
{
- typename graph_traits< Graph >::vertex_descriptor u = source(e, g),
- v = target(e, g);
+ auto u = source(e, g), v = target(e, g);
put(m_distance, v, get(m_distance, u) + 1);
put(m_predecessor, v, u);
}
template < class Edge, class Graph >
void tree_in_edge(Edge e, const Graph& g) const
{
- typename graph_traits< Graph >::vertex_descriptor u = source(e, g),
- v = target(e, g);
+ auto u = source(e, g), v = target(e, g);
put(m_distance, u, get(m_distance, v) + 1);
put(m_predecessor, u, v);
}
diff --git a/example/ordered_out_edges.cpp b/example/ordered_out_edges.cpp
index 5235eb28..16003f88 100644
--- a/example/ordered_out_edges.cpp
+++ b/example/ordered_out_edges.cpp
@@ -112,8 +112,8 @@ int main()
add_edge(3, 4, EdgeProperty("harry"), g);
add_edge(0, 1, EdgeProperty("chandler"), g);
- property_map< graph_type, vertex_index_t >::type id = get(vertex_index, g);
- property_map< graph_type, edge_name_t >::type name = get(edge_name, g);
+ auto id = get(vertex_index, g);
+ auto name = get(edge_name, g);
graph_traits< graph_type >::vertex_iterator i, end;
graph_traits< graph_type >::out_edge_iterator ei, edge_end;
diff --git a/example/ospf-example.cpp b/example/ospf-example.cpp
index 54d30a1d..d0b44df2 100644
--- a/example/ospf-example.cpp
+++ b/example/ospf-example.cpp
@@ -49,7 +49,7 @@ int main(int argc, const char** argv)
graph_traits< g_dot_type >::edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = edges(g_dot); ei != ei_end; ++ei)
{
- int weight = get(edge_weight, g_dot, *ei);
+ auto weight = get(edge_weight, g_dot, *ei);
property< edge_weight_t, int > edge_property(weight);
add_edge(source(*ei, g_dot), target(*ei, g_dot), edge_property, g);
}
@@ -71,8 +71,8 @@ int main(int argc, const char** argv)
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
std::vector< int > distance(num_vertices(g));
- property_map< Graph, edge_weight_t >::type weightmap = get(edge_weight, g);
- property_map< Graph, vertex_index_t >::type indexmap = get(vertex_index, g);
+ auto weightmap = get(edge_weight, g);
+ auto indexmap = get(vertex_index, g);
dijkstra_shortest_paths(g, router_six, &parent[0], &distance[0], weightmap,
indexmap, std::less< int >(), closed_plus< int >(),
(std::numeric_limits< int >::max)(), 0, default_dijkstra_visitor());
diff --git a/example/planar_face_traversal.cpp b/example/planar_face_traversal.cpp
index f67e34c0..e96e9c3b 100644
--- a/example/planar_face_traversal.cpp
+++ b/example/planar_face_traversal.cpp
@@ -71,7 +71,7 @@ int main(int argc, char** argv)
add_edge(5, 8, g);
// Initialize the interior edge index
- property_map< graph, edge_index_t >::type e_index = get(edge_index, g);
+ auto e_index = get(edge_index, g);
graph_traits< graph >::edges_size_type edge_count = 0;
graph_traits< graph >::edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
diff --git a/example/prim-example.cpp b/example/prim-example.cpp
index d9a78758..7136a484 100644
--- a/example/prim-example.cpp
+++ b/example/prim-example.cpp
@@ -18,12 +18,12 @@ int main()
Graph;
typedef std::pair< int, int > E;
const int num_nodes = 5;
- E edges[]
+ const auto edges
= { E(0, 2), E(1, 3), E(1, 4), E(2, 1), E(2, 3), E(3, 4), E(4, 0) };
int weights[] = { 1, 1, 2, 7, 3, 1, 1 };
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
Graph g(num_nodes);
- property_map< Graph, edge_weight_t >::type weightmap = get(edge_weight, g);
+ auto weightmap = get(edge_weight, g);
for (std::size_t j = 0; j < sizeof(edges) / sizeof(E); ++j)
{
graph_traits< Graph >::edge_descriptor e;
@@ -32,14 +32,13 @@ int main()
weightmap[e] = weights[j];
}
#else
- Graph g(edges, edges + sizeof(edges) / sizeof(E), weights, num_nodes);
+ Graph g(std::begin(edges), std::end(edges), weights, num_nodes);
#endif
std::vector< graph_traits< Graph >::vertex_descriptor > p(num_vertices(g));
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- property_map< Graph, vertex_distance_t >::type distance
- = get(vertex_distance, g);
- property_map< Graph, vertex_index_t >::type indexmap = get(vertex_index, g);
+ auto distance = get(vertex_distance, g);
+ auto indexmap = get(vertex_index, g);
prim_minimum_spanning_tree(g, *vertices(g).first, &p[0], distance,
weightmap, indexmap, default_dijkstra_visitor());
#else
diff --git a/example/prim-telephone.cpp b/example/prim-telephone.cpp
index 1f256db0..e5dd4df9 100644
--- a/example/prim-telephone.cpp
+++ b/example/prim-telephone.cpp
@@ -30,21 +30,20 @@ int main()
property< edge_weight_t, int > >
Graph;
Graph g(num_vertices(g_dot));
- property_map< GraphvizGraph, edge_attribute_t >::type edge_attr_map
- = get(edge_attribute, g_dot);
+ auto edge_attr_map = get(edge_attribute, g_dot);
graph_traits< GraphvizGraph >::edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = edges(g_dot); ei != ei_end; ++ei)
{
- int weight = lexical_cast< int >(edge_attr_map[*ei]["label"]);
+ auto weight = lexical_cast< int >(edge_attr_map[*ei]["label"]);
property< edge_weight_t, int > edge_property(weight);
add_edge(source(*ei, g_dot), target(*ei, g_dot), edge_property, g);
}
typedef graph_traits< Graph >::vertex_descriptor Vertex;
std::vector< Vertex > parent(num_vertices(g));
- property_map< Graph, edge_weight_t >::type weight = get(edge_weight, g);
+ auto weight = get(edge_weight, g);
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- property_map< Graph, vertex_index_t >::type indexmap = get(vertex_index, g);
+ auto indexmap = get(vertex_index, g);
std::vector< std::size_t > distance(num_vertices(g));
prim_minimum_spanning_tree(g, *vertices(g).first, &parent[0], &distance[0],
weight, indexmap, default_dijkstra_visitor());
@@ -53,12 +52,12 @@ int main()
#endif
int total_weight = 0;
- for (int v = 0; v < num_vertices(g); ++v)
+ for (std::size_t v = 0; v < num_vertices(g); ++v)
if (parent[v] != v)
total_weight += get(weight, edge(parent[v], v, g).first);
std::cout << "total weight: " << total_weight << std::endl;
- for (int u = 0; u < num_vertices(g); ++u)
+ for (std::size_t u = 0; u < num_vertices(g); ++u)
if (parent[u] != u)
edge_attr_map[edge(parent[u], u, g_dot).first]["color"] = "black";
std::ofstream out("figs/telephone-mst-prim.dot");
diff --git a/example/property-map-traits-eg.cpp b/example/property-map-traits-eg.cpp
index 3df92432..7c86caac 100644
--- a/example/property-map-traits-eg.cpp
+++ b/example/property-map-traits-eg.cpp
@@ -17,7 +17,7 @@ int main()
graph_t;
graph_t g;
graph_traits< graph_t >::vertex_descriptor u = add_vertex(g);
- property_map< graph_t, vertex_name_t >::type name_map = get(vertex_name, g);
+ auto name_map = get(vertex_name, g);
name_map[u] = "Joe";
std::cout << name_map[u] << std::endl;
return EXIT_SUCCESS;
diff --git a/example/property_iterator.cpp b/example/property_iterator.cpp
index e95619b3..286b81b1 100644
--- a/example/property_iterator.cpp
+++ b/example/property_iterator.cpp
@@ -106,14 +106,12 @@ int main(int argc, char* argv[])
std::cout << write(graph);
std::cout << "radii:" << std::endl;
- graph_property_iter_range< Graph, radius_t >::type seqRadius
- = get_property_iter_range(graph, radius_t());
+ auto seqRadius = get_property_iter_range(graph, radius_t());
std::for_each(seqRadius.first, seqRadius.second, Print());
std::cout << std::endl;
std::cout << "stiff:" << std::endl;
- graph_property_iter_range< Graph, stiff_t >::type seqStiff
- = get_property_iter_range(graph, stiff_t());
+ auto seqStiff = get_property_iter_range(graph, stiff_t());
std::for_each(seqStiff.first, seqStiff.second, Print());
std::cout << std::endl;
diff --git a/example/push-relabel-eg.cpp b/example/push-relabel-eg.cpp
index 04a6fa48..cf146de1 100644
--- a/example/push-relabel-eg.cpp
+++ b/example/push-relabel-eg.cpp
@@ -56,20 +56,17 @@ int main()
Graph;
Graph g;
- property_map< Graph, edge_capacity_t >::type capacity
- = get(edge_capacity, g);
- property_map< Graph, edge_residual_capacity_t >::type residual_capacity
- = get(edge_residual_capacity, g);
- property_map< Graph, edge_reverse_t >::type rev = get(edge_reverse, g);
+ auto capacity = get(edge_capacity, g);
+ auto residual_capacity = get(edge_residual_capacity, g);
+ auto rev = get(edge_reverse, g);
Traits::vertex_descriptor s, t;
read_dimacs_max_flow(g, capacity, rev, s, t);
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- property_map< Graph, vertex_index_t >::type indexmap = get(vertex_index, g);
- long flow = push_relabel_max_flow(
+ auto flow = push_relabel_max_flow(
g, s, t, capacity, residual_capacity, rev, indexmap);
#else
- long flow = push_relabel_max_flow(g, s, t);
+ auto flow = push_relabel_max_flow(g, s, t);
#endif
std::cout << "c The total flow:" << std::endl;
diff --git a/example/quick-tour.cpp b/example/quick-tour.cpp
index 8d79b72b..85f3c518 100644
--- a/example/quick-tour.cpp
+++ b/example/quick-tour.cpp
@@ -32,8 +32,7 @@ void print_vertex_names(const Graph& g, VertexNameMap name_map)
{
std::cout << "vertices(g) = { ";
typedef typename graph_traits< Graph >::vertex_iterator iter_t;
- for (std::pair< iter_t, iter_t > p = vertices(g); p.first != p.second;
- ++p.first)
+ for (auto p = vertices(g); p.first != p.second; ++p.first)
{
print_vertex_name(*p.first, name_map);
std::cout << ' ';
@@ -95,9 +94,8 @@ int main()
graph_t;
graph_t g;
- property_map< graph_t, vertex_name_t >::type name_map = get(vertex_name, g);
- property_map< graph_t, edge_weight_t >::type delay_map
- = get(edge_weight, g);
+ auto name_map = get(vertex_name, g);
+ auto delay_map = get(edge_weight, g);
build_router_network(g, name_map, delay_map);
print_vertex_names(g, name_map);
diff --git a/example/quick_tour.cpp b/example/quick_tour.cpp
index 25d1f5e1..f952c976 100644
--- a/example/quick_tour.cpp
+++ b/example/quick_tour.cpp
@@ -24,8 +24,7 @@ template < class Graph > struct exercise_vertex
void operator()(const Vertex& v) const
{
using namespace boost;
- typename property_map< Graph, vertex_index_t >::type vertex_id
- = get(vertex_index, g);
+ auto vertex_id = get(vertex_index, g);
std::cout << "vertex: " << name[get(vertex_id, v)] << std::endl;
// Write out the outgoing edges
@@ -36,7 +35,7 @@ template < class Graph > struct exercise_vertex
++out_i)
{
e = *out_i;
- Vertex src = source(e, g), targ = target(e, g);
+ auto src = source(e, g), targ = target(e, g);
std::cout << "(" << name[get(vertex_id, src)] << ","
<< name[get(vertex_id, targ)] << ") ";
}
@@ -106,7 +105,7 @@ int main(int, char*[])
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
// VC++ can't handle the iterator constructor
Graph g(num_vertices);
- property_map< Graph, edge_weight_t >::type weightmap = get(edge_weight, g);
+ auto weightmap = get(edge_weight, g);
for (std::size_t j = 0; j < num_edges; ++j)
{
graph_traits< Graph >::edge_descriptor e;
diff --git a/example/reachable-loop-head.cpp b/example/reachable-loop-head.cpp
index fcb90ff1..aa05ab0a 100644
--- a/example/reachable-loop-head.cpp
+++ b/example/reachable-loop-head.cpp
@@ -42,8 +42,7 @@ int main(int argc, char* argv[])
make_iterator_property_map(
reachable_from_head.begin(), get(vertex_index, g), c));
- property_map< GraphvizDigraph, vertex_attribute_t >::type vattr_map
- = get(vertex_attribute, g);
+ auto vattr_map = get(vertex_attribute, g);
graph_traits< GraphvizDigraph >::vertex_iterator i, i_end;
for (boost::tie(i, i_end) = vertices(g); i != i_end; ++i)
@@ -64,9 +63,7 @@ int main(int argc, char* argv[])
for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
{
loops_out << *vi << "[";
- for (std::map< std::string, std::string >::iterator ai
- = vattr_map[*vi].begin();
- ai != vattr_map[*vi].end(); ++ai)
+ for (auto ai = vattr_map[*vi].begin(); ai != vattr_map[*vi].end(); ++ai)
{
loops_out << ai->first << "=" << ai->second;
if (next(ai) != vattr_map[*vi].end())
@@ -81,9 +78,7 @@ int main(int argc, char* argv[])
{
loops_out << source(*ei, g) << " -> " << target(*ei, g) << "[";
std::map< std::string, std::string >& attr_map = eattr_map[*ei];
- for (std::map< std::string, std::string >::iterator eai
- = attr_map.begin();
- eai != attr_map.end(); ++eai)
+ for (auto eai = attr_map.begin(); eai != attr_map.end(); ++eai)
{
loops_out << eai->first << "=" << eai->second;
if (next(eai) != attr_map.end())
diff --git a/example/reachable-loop-tail.cpp b/example/reachable-loop-tail.cpp
index e3e50b0d..2d9f3dd3 100644
--- a/example/reachable-loop-tail.cpp
+++ b/example/reachable-loop-tail.cpp
@@ -56,8 +56,7 @@ int main(int argc, char* argv[])
<< " node [shape=\"box\"];\n"
<< " edge [style=\"bold\"];\n";
- property_map< Graph, vertex_attribute_t >::type vattr_map
- = get(vertex_attribute, g);
+ auto vattr_map = get(vertex_attribute, g);
graph_traits< GraphvizDigraph >::vertex_iterator i, i_end;
for (boost::tie(i, i_end) = vertices(g_in); i != i_end; ++i)
{
diff --git a/example/read_graphviz.cpp b/example/read_graphviz.cpp
index d3b39559..3b6348a4 100644
--- a/example/read_graphviz.cpp
+++ b/example/read_graphviz.cpp
@@ -35,15 +35,13 @@ int main()
graph_t graph(0);
dynamic_properties dp;
- property_map< graph_t, vertex_name_t >::type name = get(vertex_name, graph);
+ auto name = get(vertex_name, graph);
dp.property("node_id", name);
- property_map< graph_t, vertex_color_t >::type mass
- = get(vertex_color, graph);
+ auto mass = get(vertex_color, graph);
dp.property("mass", mass);
- property_map< graph_t, edge_weight_t >::type weight
- = get(edge_weight, graph);
+ auto weight = get(edge_weight, graph);
dp.property("weight", weight);
// Use ref_property_map to turn a graph property into a property map
diff --git a/example/read_write_dimacs-eg.cpp b/example/read_write_dimacs-eg.cpp
index d6435679..9d7f670c 100644
--- a/example/read_write_dimacs-eg.cpp
+++ b/example/read_write_dimacs-eg.cpp
@@ -78,10 +78,8 @@ int main()
typedef property_map< Graph, edge_capacity_t >::type tCapMap;
typedef tCapMap::value_type tCapMapValue;
- typedef property_map< Graph, edge_reverse_t >::type tRevEdgeMap;
-
- tCapMap capacity = get(edge_capacity, g);
- tRevEdgeMap rev = get(edge_reverse, g);
+ auto capacity = get(edge_capacity, g);
+ auto rev = get(edge_reverse, g);
vertex_descriptor s, t;
/*reading the graph from stdin*/
@@ -95,8 +93,8 @@ int main()
out_edge_iterator oei, oe_end;
for (boost::tie(oei, oe_end) = out_edges(s, g); oei != oe_end; ++oei)
{
- edge_descriptor from_source = *oei;
- vertex_descriptor v = target(from_source, g);
+ auto from_source = *oei;
+ auto v = target(from_source, g);
edge_descriptor to_sink;
bool is_there;
boost::tie(to_sink, is_there) = edge(v, t, g);
@@ -104,7 +102,7 @@ int main()
{
if (get(capacity, to_sink) > get(capacity, from_source))
{
- tCapMapValue to_augment = get(capacity, from_source);
+ auto to_augment = get(capacity, from_source);
capacity[from_source] = 0;
capacity[to_sink] -= to_augment;
augmented_flow += to_augment;
diff --git a/example/remove_edge_if_bidir.cpp b/example/remove_edge_if_bidir.cpp
index a58df802..9be499fd 100644
--- a/example/remove_edge_if_bidir.cpp
+++ b/example/remove_edge_if_bidir.cpp
@@ -50,7 +50,7 @@ struct has_weight_greater_than
bool operator()(graph_traits< Graph >::edge_descriptor e)
{
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- property_map< Graph, edge_weight_t >::type weight = get(edge_weight, g);
+ auto weight = get(edge_weight, g);
return get(weight, e) > w;
#else
// This version of get() breaks VC++
@@ -81,7 +81,7 @@ int main()
for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
weight[*ei] = ++w;
- property_map< Graph, vertex_index_t >::type indexmap = get(vertex_index, g);
+ auto indexmap = get(vertex_index, g);
std::cout << "original graph:" << std::endl;
print_graph(g, indexmap);
diff --git a/example/remove_edge_if_dir.cpp b/example/remove_edge_if_dir.cpp
index 825e409b..534f83f9 100644
--- a/example/remove_edge_if_dir.cpp
+++ b/example/remove_edge_if_dir.cpp
@@ -41,17 +41,10 @@ typedef adjacency_list< vecS, vecS, directedS > Graph;
int main()
{
typedef std::pair< std::size_t, std::size_t > Edge;
- Edge edges[6] = { Edge(0, 3), Edge(0, 2), Edge(0, 3), Edge(1, 3),
+ const auto edges = { Edge(0, 3), Edge(0, 2), Edge(0, 3), Edge(1, 3),
Edge(2, 0), Edge(3, 2) };
-#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- // VC++ can't handle iterator constructor
- Graph g(4);
- for (std::size_t j = 0; j < 6; ++j)
- add_edge(edges[j].first, edges[j].second, g);
-#else
- Graph g(edges, edges + 6, 4);
-#endif
+ Graph g(std::begin(edges), std::end(edges), 4);
std::cout << "original graph:" << std::endl;
print_graph(g, get(vertex_index, g));
diff --git a/example/remove_edge_if_undir.cpp b/example/remove_edge_if_undir.cpp
index 3f4b62e8..0d5f49b3 100644
--- a/example/remove_edge_if_undir.cpp
+++ b/example/remove_edge_if_undir.cpp
@@ -49,7 +49,7 @@ struct has_weight_greater_than
bool operator()(graph_traits< Graph >::edge_descriptor e)
{
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- property_map< Graph, edge_weight_t >::type weight = get(edge_weight, g);
+ auto weight = get(edge_weight, g);
return get(weight, e) > w;
#else
// This version of get breaks VC++
diff --git a/example/roget_components.cpp b/example/roget_components.cpp
index 5347acca..a90b1a9d 100644
--- a/example/roget_components.cpp
+++ b/example/roget_components.cpp
@@ -63,11 +63,9 @@ int main(int argc, char* argv[])
// a separate field for marking colors, so we use the w field.
std::vector< int > comp(num_vertices(g));
- property_map< Graph*, vertex_index_t >::type index_map
- = get(vertex_index, g);
+ auto index_map = get(vertex_index, g);
- property_map< Graph*, v_property< vertex_t > >::type root
- = get(v_property< vertex_t >(), g);
+ auto root = get(v_property< vertex_t >(), g);
int num_comp = strong_components(g,
make_iterator_property_map(comp.begin(), index_map),
@@ -131,8 +129,8 @@ int main(int argc, char* argv[])
graph_traits< Graph* >::out_edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = out_edges(v, g); ei != ei_end; ++ei)
{
- vertex_t x = target(*ei, g);
- int comp_x = comp[index_map[x]];
+ auto x = target(*ei, g);
+ auto comp_x = comp[index_map[x]];
if (comp_x != c && mark[comp_x] != c)
{
mark[comp_x] = c;
diff --git a/example/scc.cpp b/example/scc.cpp
index 142316db..94dc7d08 100644
--- a/example/scc.cpp
+++ b/example/scc.cpp
@@ -31,8 +31,7 @@ int main()
strong_components(g, make_assoc_property_map(component));
- property_map< GraphvizDigraph, vertex_attribute_t >::type vertex_attr_map
- = get(vertex_attribute, g);
+ auto vertex_attr_map = get(vertex_attribute, g);
std::string color[] = { "white", "gray", "black", "lightgray" };
graph_traits< GraphvizDigraph >::vertex_iterator vi, vi_end;
for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
diff --git a/example/sloan_ordering.cpp b/example/sloan_ordering.cpp
index 538e1060..f3b98d1e 100644
--- a/example/sloan_ordering.cpp
+++ b/example/sloan_ordering.cpp
@@ -106,13 +106,12 @@ int main(int, char*[])
graph_traits< Graph >::vertex_iterator ui, ui_end;
// Creating a property_map with the degrees of the degrees of each vertex
- property_map< Graph, vertex_degree_t >::type deg = get(vertex_degree, G);
+ auto deg = get(vertex_degree, G);
for (boost::tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui)
deg[*ui] = degree(*ui, G);
// Creating a property_map for the indices of a vertex
- property_map< Graph, vertex_index_t >::type index_map
- = get(vertex_index, G);
+ auto index_map = get(vertex_index, G);
std::cout << "original bandwidth: " << bandwidth(G) << std::endl;
std::cout << "original profile: " << profile(G) << std::endl;
@@ -147,8 +146,7 @@ int main(int, char*[])
cout << "Sloan ordering starting at: " << s << endl;
cout << " ";
- for (std::vector< Vertex >::const_iterator i = sloan_order.begin();
- i != sloan_order.end(); ++i)
+ for (auto i = sloan_order.begin(); i != sloan_order.end(); ++i)
cout << index_map[*i] << " ";
cout << endl;
@@ -192,8 +190,7 @@ int main(int, char*[])
cout << endl << "Sloan ordering without a start-vertex:" << endl;
cout << " ";
- for (std::vector< Vertex >::const_iterator i = sloan_order.begin();
- i != sloan_order.end(); ++i)
+ for (auto i = sloan_order.begin(); i != sloan_order.end(); ++i)
cout << index_map[*i] << " ";
cout << endl;
diff --git a/example/stoer_wagner.cpp b/example/stoer_wagner.cpp
index ce5b0e59..54a2c25c 100644
--- a/example/stoer_wagner.cpp
+++ b/example/stoer_wagner.cpp
@@ -45,7 +45,7 @@ int main()
// construct the graph object. 8 is the number of vertices, which are
// numbered from 0 through 7, and 16 is the number of edges.
- undirected_graph g(edges, edges + 16, ws, 8, 16);
+ undirected_graph g(std::begin(edges), std::end(edges), ws, 8, 16);
// define a property map, `parities`, that will store a boolean value for
// each vertex. Vertices that have the same parity after
diff --git a/example/strong-components.cpp b/example/strong-components.cpp
index 12265daf..4e5d876b 100644
--- a/example/strong-components.cpp
+++ b/example/strong-components.cpp
@@ -31,8 +31,7 @@ int main()
G, make_iterator_property_map(c.begin(), get(vertex_index, G), c[0]));
std::cout << "Total number of components: " << num << std::endl;
- std::vector< int >::iterator i;
- for (i = c.begin(); i != c.end(); ++i)
+ for (auto i = c.begin(); i != c.end(); ++i)
std::cout << "Vertex " << i - c.begin() << " is in component " << *i
<< std::endl;
return EXIT_SUCCESS;
diff --git a/example/subgraph_properties.cpp b/example/subgraph_properties.cpp
index ac9316fa..17d217f8 100644
--- a/example/subgraph_properties.cpp
+++ b/example/subgraph_properties.cpp
@@ -60,7 +60,7 @@ int main(int, char*[])
F
}; // for conveniently refering to vertices in G0
- property_map< Graph, vertex_name_t >::type name = get(vertex_name_t(), G0);
+ auto name = get(vertex_name_t(), G0);
name[A] = "A";
name[B] = "B";
name[C] = "C";
@@ -80,7 +80,7 @@ int main(int, char*[])
add_vertex(E, G1); // global vertex E becomes local B1 for G1
add_vertex(F, G1); // global vertex F becomes local C1 for G1
- property_map< Graph, vertex_name_t >::type name1 = get(vertex_name_t(), G1);
+ auto name1 = get(vertex_name_t(), G1);
name1[A1] = "A1";
std::cout << std::endl
@@ -120,7 +120,7 @@ int main(int, char*[])
add_vertex(A, G2); // global vertex A becomes local A2 for G2
add_vertex(C, G2); // global vertex C becomes local B2 for G2
- property_map< Graph, vertex_name_t >::type name2 = get(vertex_name_t(), G2);
+ auto name2 = get(vertex_name_t(), G2);
name2[A2] = "A2";
std::cout << std::endl
diff --git a/example/successive_shortest_path_nonnegative_weights_example.cpp b/example/successive_shortest_path_nonnegative_weights_example.cpp
index 01797203..0b0fb7fd 100644
--- a/example/successive_shortest_path_nonnegative_weights_example.cpp
+++ b/example/successive_shortest_path_nonnegative_weights_example.cpp
@@ -20,7 +20,7 @@ int main()
boost::successive_shortest_path_nonnegative_weights(g, s, t);
- int cost = boost::find_flow_cost(g);
+ auto cost = boost::find_flow_cost(g);
assert(cost == 29);
return 0;
diff --git a/example/tiernan_print_cycles.cpp b/example/tiernan_print_cycles.cpp
index 0905973a..e07c53fa 100644
--- a/example/tiernan_print_cycles.cpp
+++ b/example/tiernan_print_cycles.cpp
@@ -28,9 +28,7 @@ template < typename OutputStream > struct cycle_printer
{
// Get the property map containing the vertex indices
// so we can print them.
- typedef
- typename property_map< Graph, vertex_index_t >::const_type IndexMap;
- IndexMap indices = get(vertex_index, g);
+ auto indices = get(vertex_index, g);
// Iterate over path printing each vertex that forms the cycle.
typename Path::const_iterator i, end = p.end();
diff --git a/example/topo-sort-with-leda.cpp b/example/topo-sort-with-leda.cpp
index 42c07e2e..d4120b69 100644
--- a/example/topo-sort-with-leda.cpp
+++ b/example/topo-sort-with-leda.cpp
@@ -45,8 +45,7 @@ int main()
std::reverse(topo_order.begin(), topo_order.end());
int n = 1;
- for (std::vector< vertex_t >::iterator i = topo_order.begin();
- i != topo_order.end(); ++i, ++n)
+ for (auto i = topo_order.begin(); i != topo_order.end(); ++i, ++n)
std::cout << n << ": " << leda_g[*i] << std::endl;
return EXIT_SUCCESS;
diff --git a/example/topo-sort-with-sgb.cpp b/example/topo-sort-with-sgb.cpp
index 7453c3d3..eb43a89f 100644
--- a/example/topo-sort-with-sgb.cpp
+++ b/example/topo-sort-with-sgb.cpp
@@ -36,8 +36,7 @@ int main()
topological_sort(sgb_g, std::back_inserter(topo_order),
vertex_index_map(get(vertex_index, sgb_g)));
int n = 1;
- for (std::vector< vertex_t >::reverse_iterator i = topo_order.rbegin();
- i != topo_order.rend(); ++i, ++n)
+ for (auto i = topo_order.rbegin(); i != topo_order.rend(); ++i, ++n)
std::cout << n << ": " << tasks[get(vertex_index, sgb_g)[*i]]
<< std::endl;
diff --git a/example/topo-sort1.cpp b/example/topo-sort1.cpp
index 6579d0e0..9b5b0dd2 100644
--- a/example/topo-sort1.cpp
+++ b/example/topo-sort1.cpp
@@ -19,26 +19,17 @@ int main()
= { "pick up kids from school", "buy groceries (and snacks)",
"get cash at ATM", "drop off kids at soccer practice",
"cook dinner", "pick up kids from soccer", "eat dinner" };
- const int n_tasks = sizeof(tasks) / sizeof(char*);
- std::vector< std::list< int > > g(n_tasks);
- g[0].push_back(3);
- g[1].push_back(3);
- g[1].push_back(4);
- g[2].push_back(1);
- g[3].push_back(5);
- g[4].push_back(6);
- g[5].push_back(6);
+ std::vector< std::list< int > > g
+ = { { 3 }, { 3, 4 }, { 1 }, { 5 }, { 6 }, { 6 }, {} };
std::deque< int > topo_order;
topological_sort(g, std::front_inserter(topo_order),
vertex_index_map(identity_property_map()));
- int n = 1;
- for (std::deque< int >::iterator i = topo_order.begin();
- i != topo_order.end(); ++i, ++n)
- std::cout << tasks[*i] << std::endl;
+ for (auto const& vertex : topo_order)
+ std::cout << tasks[vertex] << std::endl;
return EXIT_SUCCESS;
}
diff --git a/example/topo-sort2.cpp b/example/topo-sort2.cpp
index 80aa3412..941abcb4 100644
--- a/example/topo-sort2.cpp
+++ b/example/topo-sort2.cpp
@@ -35,10 +35,8 @@ int main()
topological_sort(g, std::front_inserter(topo_order),
vertex_index_map(identity_property_map()));
- int n = 1;
- for (std::deque< int >::iterator i = topo_order.begin();
- i != topo_order.end(); ++i, ++n)
- std::cout << tasks[*i] << std::endl;
+ for (auto const& vertex : topo_order)
+ std::cout << tasks[vertex] << std::endl;
return EXIT_SUCCESS;
}
diff --git a/example/topo_sort.cpp b/example/topo_sort.cpp
index 38dc4667..398814a4 100644
--- a/example/topo_sort.cpp
+++ b/example/topo_sort.cpp
@@ -43,26 +43,19 @@ int main(int, char*[])
Graph;
typedef boost::graph_traits< Graph >::vertex_descriptor Vertex;
- Pair edges[6] = { Pair(0, 1), Pair(2, 4), Pair(2, 5), Pair(0, 3),
+ const auto edges = { Pair(0, 1), Pair(2, 4), Pair(2, 5), Pair(0, 3),
Pair(1, 4), Pair(4, 3) };
-#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- // VC++ can't handle the iterator constructor
- Graph G(6);
- for (std::size_t j = 0; j < 6; ++j)
- add_edge(edges[j].first, edges[j].second, G);
-#else
- Graph G(edges, edges + 6, 6);
-#endif
- boost::property_map< Graph, vertex_index_t >::type id
- = get(vertex_index, G);
+ Graph G(std::begin(edges), std::end(edges), 6 /* vertices count */);
+
+ auto id = get(vertex_index, G);
typedef std::vector< Vertex > container;
container c;
topological_sort(G, std::back_inserter(c));
std::cout << "A topological ordering: ";
- for (container::reverse_iterator ii = c.rbegin(); ii != c.rend(); ++ii)
+ for (auto ii = c.rbegin(); ii != c.rend(); ++ii)
std::cout << id[*ii] << " ";
std::cout << std::endl;
diff --git a/example/transpose-example.cpp b/example/transpose-example.cpp
index 618a288b..3f7d8fe1 100644
--- a/example/transpose-example.cpp
+++ b/example/transpose-example.cpp
@@ -30,7 +30,7 @@ int main()
N
};
graph_t G(N);
- property_map< graph_t, vertex_name_t >::type name_map = get(vertex_name, G);
+ auto name_map = get(vertex_name, G);
char name = 'a';
graph_traits< graph_t >::vertex_iterator v, v_end;
for (boost::tie(v, v_end) = vertices(G); v != v_end; ++v, ++name)
diff --git a/example/two_graphs_common_spanning_trees.cpp b/example/two_graphs_common_spanning_trees.cpp
index 824556db..0a209bf4 100644
--- a/example/two_graphs_common_spanning_trees.cpp
+++ b/example/two_graphs_common_spanning_trees.cpp
@@ -36,22 +36,15 @@ typedef boost::graph_traits< Graph >::edge_iterator edge_iterator;
int main(int argc, char** argv)
{
Graph iG, vG;
- vector< edge_descriptor > iG_o;
- vector< edge_descriptor > vG_o;
+ vector< edge_descriptor > iG_o = { boost::add_edge(0, 1, iG).first,
+ boost::add_edge(0, 2, iG).first, boost::add_edge(0, 3, iG).first,
+ boost::add_edge(0, 4, iG).first, boost::add_edge(1, 2, iG).first,
+ boost::add_edge(3, 4, iG).first };
- iG_o.push_back(boost::add_edge(0, 1, iG).first);
- iG_o.push_back(boost::add_edge(0, 2, iG).first);
- iG_o.push_back(boost::add_edge(0, 3, iG).first);
- iG_o.push_back(boost::add_edge(0, 4, iG).first);
- iG_o.push_back(boost::add_edge(1, 2, iG).first);
- iG_o.push_back(boost::add_edge(3, 4, iG).first);
-
- vG_o.push_back(boost::add_edge(1, 2, vG).first);
- vG_o.push_back(boost::add_edge(2, 0, vG).first);
- vG_o.push_back(boost::add_edge(2, 3, vG).first);
- vG_o.push_back(boost::add_edge(4, 3, vG).first);
- vG_o.push_back(boost::add_edge(0, 3, vG).first);
- vG_o.push_back(boost::add_edge(0, 4, vG).first);
+ vector< edge_descriptor > vG_o = { boost::add_edge(1, 2, vG).first,
+ boost::add_edge(2, 0, vG).first, boost::add_edge(2, 3, vG).first,
+ boost::add_edge(4, 3, vG).first, boost::add_edge(0, 3, vG).first,
+ boost::add_edge(0, 4, vG).first };
vector< bool > inL(iG_o.size(), false);
@@ -62,8 +55,7 @@ int main(int argc, char** argv)
boost::two_graphs_common_spanning_trees(
iG, iG_o, vG, vG_o, tree_collector, inL);
- std::vector< std::vector< bool > >::iterator it;
- for (it = coll.begin(); it != coll.end(); ++it)
+ for (auto const & vec : coll)
{
// Here you can play with the trees that the algorithm has found.
}
diff --git a/example/undirected_adjacency_list.cpp b/example/undirected_adjacency_list.cpp
index 9e360149..4836d50e 100644
--- a/example/undirected_adjacency_list.cpp
+++ b/example/undirected_adjacency_list.cpp
@@ -14,13 +14,12 @@ template < typename UndirectedGraph > void undirected_graph_demo1()
{
const int V = 3;
UndirectedGraph undigraph(V);
- typename graph_traits< UndirectedGraph >::vertex_descriptor zero, one, two;
typename graph_traits< UndirectedGraph >::out_edge_iterator out, out_end;
typename graph_traits< UndirectedGraph >::in_edge_iterator in, in_end;
- zero = vertex(0, undigraph);
- one = vertex(1, undigraph);
- two = vertex(2, undigraph);
+ auto zero = vertex(0, undigraph);
+ auto one = vertex(1, undigraph);
+ auto two = vertex(2, undigraph);
add_edge(zero, one, undigraph);
add_edge(zero, two, undigraph);
add_edge(one, two, undigraph);
@@ -39,15 +38,13 @@ template < typename DirectedGraph > void directed_graph_demo()
{
const int V = 2;
DirectedGraph digraph(V);
- typename graph_traits< DirectedGraph >::vertex_descriptor u, v;
typedef typename DirectedGraph::edge_property_type Weight;
- typename property_map< DirectedGraph, edge_weight_t >::type weight
- = get(edge_weight, digraph);
+ auto weight = get(edge_weight, digraph);
typename graph_traits< DirectedGraph >::edge_descriptor e1, e2;
bool found;
- u = vertex(0, digraph);
- v = vertex(1, digraph);
+ auto u = vertex(0, digraph);
+ auto v = vertex(1, digraph);
add_edge(u, v, Weight(1.2), digraph);
add_edge(v, u, Weight(2.4), digraph);
boost::tie(e1, found) = edge(u, v, digraph);
@@ -68,15 +65,14 @@ template < typename UndirectedGraph > void undirected_graph_demo2()
{
const int V = 2;
UndirectedGraph undigraph(V);
- typename graph_traits< UndirectedGraph >::vertex_descriptor u, v;
typedef typename UndirectedGraph::edge_property_type Weight;
typename property_map< UndirectedGraph, edge_weight_t >::type weight
= get(edge_weight, undigraph);
typename graph_traits< UndirectedGraph >::edge_descriptor e1, e2;
bool found;
- u = vertex(0, undigraph);
- v = vertex(1, undigraph);
+ auto u = vertex(0, undigraph);
+ auto v = vertex(1, undigraph);
add_edge(u, v, Weight(3.1), undigraph);
boost::tie(e1, found) = edge(u, v, undigraph);
boost::tie(e2, found) = edge(v, u, undigraph);
@@ -92,8 +88,7 @@ template < typename UndirectedGraph > void undirected_graph_demo2()
std::cout << "the edges incident to v: ";
typename boost::graph_traits< UndirectedGraph >::out_edge_iterator e, e_end;
- typename boost::graph_traits< UndirectedGraph >::vertex_descriptor s
- = vertex(0, undigraph);
+ auto s = vertex(0, undigraph);
for (boost::tie(e, e_end) = out_edges(s, undigraph); e != e_end; ++e)
std::cout << "(" << source(*e, undigraph) << ","
<< target(*e, undigraph) << ")" << std::endl;
diff --git a/example/undirected_graph.cpp b/example/undirected_graph.cpp
index 0c0365ce..3fa2847c 100644
--- a/example/undirected_graph.cpp
+++ b/example/undirected_graph.cpp
@@ -18,9 +18,9 @@ int main(int, char*[])
Graph g;
// Add vertices
- boost::graph_traits< Graph >::vertex_descriptor v0 = g.add_vertex();
- boost::graph_traits< Graph >::vertex_descriptor v1 = g.add_vertex();
- boost::graph_traits< Graph >::vertex_descriptor v2 = g.add_vertex();
+ auto v0 = g.add_vertex();
+ auto v1 = g.add_vertex();
+ auto v2 = g.add_vertex();
// Add edges
g.add_edge(v0, v1);
diff --git a/example/vector_as_graph.cpp b/example/vector_as_graph.cpp
index f9e785ed..0000a0fc 100644
--- a/example/vector_as_graph.cpp
+++ b/example/vector_as_graph.cpp
@@ -27,22 +27,18 @@ int main()
v,
w,
x,
- y,
- N
+ y
};
char name[] = "rstuvwxy";
typedef std::vector< std::list< int > > Graph;
- Graph g(N);
- g[r].push_back(v);
- g[s].push_back(r);
- g[s].push_back(r);
- g[s].push_back(w);
- g[t].push_back(x);
- g[u].push_back(t);
- g[w].push_back(t);
- g[w].push_back(x);
- g[x].push_back(y);
- g[y].push_back(u);
+ Graph g = { { v }, // r
+ { r, r, w }, // s
+ { x }, // t
+ { t }, // u
+ {}, // v
+ { t, x }, // w
+ { y }, // x
+ { u } }; // y
boost::print_graph(g, name);
return 0;
}
diff --git a/example/vertex-name-property.cpp b/example/vertex-name-property.cpp
index c1a3b0b7..0971334c 100644
--- a/example/vertex-name-property.cpp
+++ b/example/vertex-name-property.cpp
@@ -67,8 +67,7 @@ int main(int argc, const char** argv)
}
// Obtain internal property map from the graph
- property_map< graph_type, vertex_name_t >::type name_map
- = get(vertex_name, g);
+ auto name_map = get(vertex_name, g);
read_graph_file(file_in, name_in, g, name_map);
// Create storage for last modified times
diff --git a/example/vertex_basics.cpp b/example/vertex_basics.cpp
index 107fd5eb..4cbc0bf3 100644
--- a/example/vertex_basics.cpp
+++ b/example/vertex_basics.cpp
@@ -61,11 +61,10 @@ template < class Graph > struct print_edge
typedef typename boost::graph_traits< Graph >::vertex_descriptor Vertex;
void operator()(Edge e) const
{
- typename boost::property_map< Graph, vertex_index_t >::type id
- = get(vertex_index, G);
+ auto id = get(vertex_index, G);
- Vertex src = source(e, G);
- Vertex targ = target(e, G);
+ auto src = source(e, G);
+ auto targ = target(e, G);
cout << "(" << id[src] << "," << id[targ] << ") ";
}
diff --git a/example/vf2_sub_graph_iso_multi_example.cpp b/example/vf2_sub_graph_iso_multi_example.cpp
index 330fe28c..235df83d 100644
--- a/example/vf2_sub_graph_iso_multi_example.cpp
+++ b/example/vf2_sub_graph_iso_multi_example.cpp
@@ -69,16 +69,9 @@ int main()
add_edge(5, 0, edge_property('s'), graph2);
// create predicates
- typedef property_map< graph_type, vertex_name_t >::type vertex_name_map_t;
- typedef property_map_equivalent< vertex_name_map_t, vertex_name_map_t >
- vertex_comp_t;
- vertex_comp_t vertex_comp = make_property_map_equivalent(
+ auto vertex_comp = make_property_map_equivalent(
get(vertex_name, graph1), get(vertex_name, graph2));
-
- typedef property_map< graph_type, edge_name_t >::type edge_name_map_t;
- typedef property_map_equivalent< edge_name_map_t, edge_name_map_t >
- edge_comp_t;
- edge_comp_t edge_comp = make_property_map_equivalent(
+ auto edge_comp = make_property_map_equivalent(
get(edge_name, graph1), get(edge_name, graph2));
// Create callback
diff --git a/example/visitor.cpp b/example/visitor.cpp
index 8620c116..75b83e30 100644
--- a/example/visitor.cpp
+++ b/example/visitor.cpp
@@ -71,15 +71,9 @@ int main(int, char*[])
typedef adjacency_list<> Graph;
typedef std::pair< int, int > E;
- E edges[] = { E(0, 2), E(1, 1), E(1, 3), E(2, 1), E(2, 3), E(3, 1), E(3, 4),
- E(4, 0), E(4, 1) };
-#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- Graph G(5);
- for (std::size_t j = 0; j < sizeof(edges) / sizeof(E); ++j)
- add_edge(edges[j].first, edges[j].second, G);
-#else
- Graph G(edges, edges + sizeof(edges) / sizeof(E), 5);
-#endif
+ const auto edges = { E(0, 2), E(1, 1), E(1, 3), E(2, 1), E(2, 3), E(3, 1),
+ E(3, 4), E(4, 0), E(4, 1) };
+ Graph G(std::begin(edges), std::end(edges), 5);
typedef boost::graph_traits< Graph >::vertices_size_type size_type;
diff --git a/include/boost/graph/adjacency_list.hpp b/include/boost/graph/adjacency_list.hpp
index e5050b5b..113143a7 100644
--- a/include/boost/graph/adjacency_list.hpp
+++ b/include/boost/graph/adjacency_list.hpp
@@ -267,18 +267,21 @@ template < class OutEdgeListS = vecS, // a Sequence or an AssociativeContainer
class EdgeProperty = no_property, class GraphProperty = no_property,
class EdgeListS = listS >
class adjacency_list
-: public detail::adj_list_gen<
- adjacency_list< OutEdgeListS, VertexListS, DirectedS, VertexProperty,
- EdgeProperty, GraphProperty, EdgeListS >,
- VertexListS, OutEdgeListS, DirectedS, VertexProperty, EdgeProperty,
- GraphProperty, EdgeListS >::type,
- // Support for named vertices
+: // Support for named vertices
+ // This needs to be inherited from first to ensure it's initialized before the
+ // "base" (i.e. detail::adj_list_gen), because the "base" might indirectly
+ // call functions on it during its construction.
public graph::maybe_named_graph<
adjacency_list< OutEdgeListS, VertexListS, DirectedS, VertexProperty,
EdgeProperty, GraphProperty, EdgeListS >,
typename adjacency_list_traits< OutEdgeListS, VertexListS, DirectedS,
EdgeListS >::vertex_descriptor,
- VertexProperty >
+ VertexProperty >,
+ public detail::adj_list_gen<
+ adjacency_list< OutEdgeListS, VertexListS, DirectedS, VertexProperty,
+ EdgeProperty, GraphProperty, EdgeListS >,
+ VertexListS, OutEdgeListS, DirectedS, VertexProperty, EdgeProperty,
+ GraphProperty, EdgeListS >::type
{
public:
typedef GraphProperty graph_property_type;
diff --git a/include/boost/graph/adjacency_matrix.hpp b/include/boost/graph/adjacency_matrix.hpp
index a089e1cb..83c22de5 100644
--- a/include/boost/graph/adjacency_matrix.hpp
+++ b/include/boost/graph/adjacency_matrix.hpp
@@ -433,7 +433,8 @@ struct adj_matrix_traversal_tag : public virtual adjacency_matrix_tag,
public virtual vertex_list_graph_tag,
public virtual incidence_graph_tag,
public virtual adjacency_graph_tag,
- public virtual edge_list_graph_tag
+ public virtual edge_list_graph_tag,
+ public virtual bidirectional_graph_tag
{
};
@@ -826,6 +827,27 @@ typename adjacency_matrix< D, VP, EP, GP, A >::degree_size_type in_degree(
return n;
}
+// O(N)
+template < typename VP, typename EP, typename GP, typename A >
+typename adjacency_matrix< directedS, VP, EP, GP, A >::degree_size_type
+degree(
+ typename adjacency_matrix< directedS, VP, EP, GP, A >::vertex_descriptor u,
+ const adjacency_matrix< directedS, VP, EP, GP, A >& g)
+{
+ return in_degree(u, g) + out_degree(u, g);
+}
+
+// O(N)
+template < typename VP, typename EP, typename GP, typename A >
+typename adjacency_matrix< undirectedS, VP, EP, GP, A >::degree_size_type
+degree(
+ typename adjacency_matrix< undirectedS, VP, EP, GP, A >::vertex_descriptor
+ u,
+ const adjacency_matrix< undirectedS, VP, EP, GP, A >& g)
+{
+ return out_degree(u, g);
+}
+
//=========================================================================
// Functions required by the AdjacencyGraph concept
diff --git a/include/boost/graph/bron_kerbosch_all_cliques.hpp b/include/boost/graph/bron_kerbosch_all_cliques.hpp
index e0f862e8..28bc10f2 100644
--- a/include/boost/graph/bron_kerbosch_all_cliques.hpp
+++ b/include/boost/graph/bron_kerbosch_all_cliques.hpp
@@ -104,7 +104,7 @@ struct max_clique_visitor
max_clique_visitor(std::size_t& max) : maximum(max) {}
template < typename Clique, typename Graph >
- inline void clique(const Clique& p, const Graph& g)
+ inline void clique(const Clique& p, const Graph&)
{
BOOST_USING_STD_MAX();
maximum = max BOOST_PREVENT_MACRO_SUBSTITUTION(maximum, p.size());
@@ -220,7 +220,7 @@ namespace detail
// otherwise, iterate over candidates and and test
// for maxmimal cliquiness.
- typename Container::iterator i, j;
+ typename Container::iterator i;
for (i = cands.begin(); i != cands.end();)
{
Vertex candidate = *i;
diff --git a/include/boost/graph/cycle_canceling.hpp b/include/boost/graph/cycle_canceling.hpp
index 5aaa25e7..c355db51 100644
--- a/include/boost/graph/cycle_canceling.hpp
+++ b/include/boost/graph/cycle_canceling.hpp
@@ -172,7 +172,7 @@ namespace detail
template < class Graph, class P, class T, class R >
void cycle_canceling(Graph& g, const bgl_named_params< P, T, R >& params)
{
- cycle_canceling_dispatch1(g,
+ detail::cycle_canceling_dispatch1(g,
choose_const_pmap(get_param(params, edge_weight), g, edge_weight),
choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse),
choose_pmap(get_param(params, edge_residual_capacity), g,
diff --git a/include/boost/graph/detail/adjacency_list.hpp b/include/boost/graph/detail/adjacency_list.hpp
index ed5a1d48..5358fdba 100644
--- a/include/boost/graph/detail/adjacency_list.hpp
+++ b/include/boost/graph/detail/adjacency_list.hpp
@@ -2228,9 +2228,10 @@ inline typename Config::vertex_descriptor add_vertex(
vec_adj_list_impl< Graph, Config, Base >& g_)
{
Graph& g = static_cast< Graph& >(g_);
- g.m_vertices.resize(g.m_vertices.size() + 1);
- g.added_vertex(g.m_vertices.size() - 1);
- return g.m_vertices.size() - 1;
+ auto const added_descriptor = g.m_vertices.size();
+ g.m_vertices.emplace_back();
+ g.added_vertex(added_descriptor);
+ return added_descriptor;
}
template < class Graph, class Config, class Base >
@@ -2243,10 +2244,10 @@ inline typename Config::vertex_descriptor add_vertex(
if (optional< vertex_descriptor > v
= g.vertex_by_property(get_property_value(p, vertex_bundle)))
return *v;
- typedef typename Config::stored_vertex stored_vertex;
- g.m_vertices.push_back(stored_vertex(p));
- g.added_vertex(g.m_vertices.size() - 1);
- return g.m_vertices.size() - 1;
+ auto const added_descriptor = g.m_vertices.size();
+ g.m_vertices.emplace_back(p);
+ g.added_vertex(added_descriptor);
+ return added_descriptor;
}
// Here we override the directed_graph_helper add_edge() function
diff --git a/include/boost/graph/dominator_tree.hpp b/include/boost/graph/dominator_tree.hpp
index df9783b0..afe741fc 100644
--- a/include/boost/graph/dominator_tree.hpp
+++ b/include/boost/graph/dominator_tree.hpp
@@ -10,8 +10,8 @@
#define BOOST_GRAPH_DOMINATOR_HPP
#include
-#include
#include
+#include
#include
#include
@@ -62,6 +62,21 @@ namespace detail
Tag >(timeMap, v, t);
}
+ // Auxiliary structure of different kinds of predecessors are used to
+ // calculate the semidominators: ancestor, semidominator, and the ancestor
+ // with the lowest semidominator (`best`). Placing these predecessors in a
+ // structure let us organize a "vector of structs" what improves cache
+ // efficiency.
+ template < class Graph >
+ struct vertex_triple
+ {
+ using Vertex = typename graph_traits< Graph >::vertex_descriptor;
+
+ Vertex semi { graph_traits< Graph >::null_vertex() };
+ Vertex ancestor { graph_traits< Graph >::null_vertex() };
+ Vertex best { graph_traits< Graph >::null_vertex() };
+ };
+
template < class Graph, class IndexMap, class TimeMap, class PredMap,
class DomTreePredMap >
class dominator_visitor
@@ -80,13 +95,9 @@ namespace detail
*/
dominator_visitor(const Graph& g, const Vertex& entry,
const IndexMap& indexMap, DomTreePredMap domTreePredMap)
- : semi_(num_vertices(g))
- , ancestor_(num_vertices(g), graph_traits< Graph >::null_vertex())
- , samedom_(ancestor_)
- , best_(semi_)
- , semiMap_(make_iterator_property_map(semi_.begin(), indexMap))
- , ancestorMap_(make_iterator_property_map(ancestor_.begin(), indexMap))
- , bestMap_(make_iterator_property_map(best_.begin(), indexMap))
+ : pred_(num_vertices(g))
+ , predMap_(make_iterator_property_map(pred_.begin(), indexMap))
+ , samedom_(num_vertices(g), graph_traits< Graph >::null_vertex())
, buckets_(num_vertices(g))
, bucketMap_(make_iterator_property_map(buckets_.begin(), indexMap))
, entry_(entry)
@@ -132,18 +143,18 @@ namespace detail
if (get(dfnumMap, v) <= get(dfnumMap, n))
s2 = v;
else
- s2 = get(semiMap_, ancestor_with_lowest_semi_(v, dfnumMap));
+ s2 = get(predMap_, ancestor_with_lowest_semi_(v, dfnumMap))
+ .semi;
if (get(dfnumMap, s2) < get(dfnumMap, s))
s = s2;
}
- put(semiMap_, n, s);
+ auto& pred_of_n = get(predMap_, n);
+ pred_of_n = {s, p, n};
// 2. Calculation of n's dominator is deferred until
// the path from s to n has been linked into the forest
get(bucketMap_, s).push_back(n);
- get(ancestorMap_, n) = p;
- get(bestMap_, n) = n;
// 3. Now that the path from p to v has been linked into
// the spanning forest, these lines calculate the dominator of v,
@@ -155,13 +166,13 @@ namespace detail
//
// idom(n) = semi(n) if semi(y)=semi(n) or
// idom(y) if semi(y) != semi(n)
- typename std::deque< Vertex >::iterator buckItr;
+ typename std::vector< Vertex >::iterator buckItr;
for (buckItr = get(bucketMap_, p).begin();
buckItr != get(bucketMap_, p).end(); ++buckItr)
{
const Vertex v(*buckItr);
const Vertex y(ancestor_with_lowest_semi_(v, dfnumMap));
- if (get(semiMap_, y) == get(semiMap_, v))
+ if (get(predMap_, y).semi == get(predMap_, v).semi)
put(domTreePredMap_, v, p);
else
put(samedomMap, v, y);
@@ -177,28 +188,36 @@ namespace detail
const Vertex ancestor_with_lowest_semi_(
const Vertex& v, const TimeMap& dfnumMap)
{
- const Vertex a(get(ancestorMap_, v));
+ const Vertex a(get(predMap_, v).ancestor);
+ const auto& pred_of_a = get(predMap_, a);
- if (get(ancestorMap_, a) != graph_traits< Graph >::null_vertex())
+ auto& pred_of_v = get(predMap_, v);
+
+ if (pred_of_a.ancestor != graph_traits< Graph >::null_vertex())
{
const Vertex b(ancestor_with_lowest_semi_(a, dfnumMap));
+ const auto& pred_of_b = get(predMap_, b);
- put(ancestorMap_, v, get(ancestorMap_, a));
+ pred_of_v.ancestor = pred_of_a.ancestor;
- if (get(dfnumMap, get(semiMap_, b))
- < get(dfnumMap, get(semiMap_, get(bestMap_, v))))
- put(bestMap_, v, b);
+ if (get(dfnumMap, pred_of_b.semi)
+ < get(dfnumMap, get(predMap_, pred_of_v.best).semi))
+ pred_of_v.best = b;
}
- return get(bestMap_, v);
+ return pred_of_v.best;
}
- std::vector< Vertex > semi_, ancestor_, samedom_, best_;
- PredMap semiMap_, ancestorMap_, bestMap_;
- std::vector< std::deque< Vertex > > buckets_;
+ std::vector< vertex_triple< Graph > > pred_;
+ iterator_property_map< typename std::vector< vertex_triple< Graph > >::iterator,
+ IndexMap >
+ predMap_;
+
+ std::vector< Vertex > samedom_;
+ std::vector< std::vector< Vertex > > buckets_;
iterator_property_map<
- typename std::vector< std::deque< Vertex > >::iterator, IndexMap >
+ typename std::vector< std::vector< Vertex > >::iterator, IndexMap >
bucketMap_;
const Vertex& entry_;
diff --git a/include/boost/graph/graph_traits.hpp b/include/boost/graph/graph_traits.hpp
index 208cef1f..ea865217 100644
--- a/include/boost/graph/graph_traits.hpp
+++ b/include/boost/graph/graph_traits.hpp
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/include/boost/graph/howard_cycle_ratio.hpp b/include/boost/graph/howard_cycle_ratio.hpp
index fe6c5bd9..8163e63b 100644
--- a/include/boost/graph/howard_cycle_ratio.hpp
+++ b/include/boost/graph/howard_cycle_ratio.hpp
@@ -13,7 +13,6 @@
#include
#include
-#include
#include
#include
#include
@@ -241,14 +240,10 @@ namespace detail
typename graph_traits< Graph >::out_edge_iterator oei, oeie;
for (boost::tie(vi, vie) = vertices(m_g); vi != vie; ++vi)
{
- using namespace boost::placeholders;
-
boost::tie(oei, oeie) = out_edges(*vi, m_g);
- typename graph_traits< Graph >::out_edge_iterator mei
- = boost::first_max_element(oei, oeie,
- boost::bind(m_cmp,
- boost::bind(&EdgeWeight1::operator[], m_ew1m, _1),
- boost::bind(&EdgeWeight1::operator[], m_ew1m, _2)));
+ auto mei = boost::first_max_element(oei, oeie,
+ [this](const auto& first, const auto& second)
+ { return m_cmp(m_ew1m[first], m_ew1m[second]); });
if (mei == oeie)
{
if (m_sink == graph_traits< Graph >().null_vertex())
@@ -356,16 +351,17 @@ namespace detail
*/
float_t policy_mcr()
{
- using namespace boost::placeholders;
-
std::fill(m_col_bfs.begin(), m_col_bfs.end(), my_white);
color_map_t vcm_ = color_map_t(m_col_bfs.begin(), m_vim);
typename graph_traits< Graph >::vertex_iterator uv_itr, vie;
boost::tie(uv_itr, vie) = vertices(m_g);
float_t mcr = m_bound;
while ((uv_itr = std::find_if(uv_itr, vie,
- boost::bind(std::equal_to< my_color_type >(), my_white,
- boost::bind(&color_map_t::operator[], vcm_, _1))))
+ [this, &vcm_](const auto& uv)
+ {
+ return std::equal_to< my_color_type >()(
+ my_white, vcm_[uv]);
+ }))
!= vie)
/// While there are undiscovered vertices
{
diff --git a/include/boost/graph/is_straight_line_drawing.hpp b/include/boost/graph/is_straight_line_drawing.hpp
index 013f4b40..d7701540 100644
--- a/include/boost/graph/is_straight_line_drawing.hpp
+++ b/include/boost/graph/is_straight_line_drawing.hpp
@@ -16,74 +16,44 @@
#include
#include
+#include
+#include
+#include
+
+#include
+
#include
#include
-#include
#include