From 2e36dc62ab4dcf970f35e7d2048d58fb38a2463e Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 5 Mar 2001 20:01:01 +0000 Subject: [PATCH] Join ralf_grosse_kunstleve with HEAD [SVN r9444] --- example/LEDA_concept_check.cpp | 6 +- example/boost_web_graph.exp | 37 -------- example/connected_components.expected | 11 --- example/dynamic_components.expected | 18 ---- example/reverse_graph.cpp | 37 ++++---- example/visitor.cpp | 2 +- .../boost/graph/detail/adjacency_iterator.hpp | 92 ------------------- include/boost/graph/edge_connectivity.hpp | 8 +- include/boost/graph/edmunds_karp_max_flow.hpp | 42 ++++++--- 9 files changed, 52 insertions(+), 201 deletions(-) delete mode 100644 example/boost_web_graph.exp delete mode 100644 example/dynamic_components.expected delete mode 100644 include/boost/graph/detail/adjacency_iterator.hpp diff --git a/example/LEDA_concept_check.cpp b/example/LEDA_concept_check.cpp index b7e7d71e..fa074e17 100644 --- a/example/LEDA_concept_check.cpp +++ b/example/LEDA_concept_check.cpp @@ -32,9 +32,9 @@ main(int,char*[]) using namespace boost; { typedef GRAPH Graph; - REQUIRE(Graph, VertexListGraph); - REQUIRE(Graph, BidirectionalGraph); - REQUIRE(Graph, MutableGraph); + function_requires< VertexListGraphConcept >(); + function_requires< BidirectionalGraphConcept >(); + function_requires< MutableGraphConcept >(); } return 0; } diff --git a/example/boost_web_graph.exp b/example/boost_web_graph.exp deleted file mode 100644 index ea1ce0db..00000000 --- a/example/boost_web_graph.exp +++ /dev/null @@ -1,37 +0,0 @@ -The diameter of the boost web-site graph is 3 - -Number of clicks from the home page: -0 www.boost.org -1 Boost Libraries -1 More Information -1 Boost People -1 Frequently Asked Questions -2 Boost Header Dependencies -2 Compiler Status -2 Formal Review Process -2 Boost Library Requirements and Guidelines -2 Dave Abrahams -2 Darin Adler -2 Call Traits -2 Compose Library -2 Boost Graph Library -2 Property Map Library -2 Array wrapper - -The breadth-first search tree: -www.boost.org - Boost Libraries - Call Traits - Compose Library - Boost Graph Library - Property Map Library - Array wrapper - More Information - Boost Header Dependencies - Compiler Status - Formal Review Process - Boost People - Dave Abrahams - Darin Adler - Frequently Asked Questions - Boost Library Requirements and Guidelines diff --git a/example/connected_components.expected b/example/connected_components.expected index 12c6bd06..862d9347 100644 --- a/example/connected_components.expected +++ b/example/connected_components.expected @@ -1,5 +1,3 @@ -An undirected graph: - Total number of components: 3 Vertex 0 is in component 0 Vertex 1 is in component 0 @@ -8,12 +6,3 @@ Vertex 3 is in component 2 Vertex 4 is in component 0 Vertex 5 is in component 1 -A directed graph: - -Total number of components: 3 -Vertex 0 is in component 2 -Vertex 1 is in component 2 -Vertex 2 is in component 1 -Vertex 3 is in component 2 -Vertex 4 is in component 2 -Vertex 5 is in component 0 diff --git a/example/dynamic_components.expected b/example/dynamic_components.expected deleted file mode 100644 index c1e0b510..00000000 --- a/example/dynamic_components.expected +++ /dev/null @@ -1,18 +0,0 @@ -An undirected graph: -0 <--> 1 4 -1 <--> 0 4 -2 <--> 5 -3 <--> -4 <--> 1 0 -5 <--> 2 - -representative[0] = 1 -representative[1] = 1 -representative[2] = 5 -representative[3] = 3 -representative[4] = 1 -representative[5] = 5 - -component 0 contains: 4 1 0 -component 1 contains: 3 -component 2 contains: 5 2 diff --git a/example/reverse_graph.cpp b/example/reverse_graph.cpp index e6f04869..07ce111a 100644 --- a/example/reverse_graph.cpp +++ b/example/reverse_graph.cpp @@ -34,33 +34,28 @@ #include #include -int -main() +int main() { - typedef boost::adjacency_list< - boost::vecS, boost::vecS, boost::bidirectionalS - > Graph; + using namespace boost; + typedef adjacency_list Graph; Graph G(5); - boost::add_edge(0, 2, G); - boost::add_edge(1, 1, G); - boost::add_edge(1, 3, G); - boost::add_edge(1, 4, G); - boost::add_edge(2, 1, G); - boost::add_edge(2, 3, G); - boost::add_edge(2, 4, G); - boost::add_edge(3, 1, G); - boost::add_edge(3, 4, G); - boost::add_edge(4, 0, G); - boost::add_edge(4, 1, G); + add_edge(0, 2, G); + add_edge(1, 1, G); + add_edge(1, 3, G); + add_edge(1, 4, G); + add_edge(2, 1, G); + add_edge(2, 3, G); + add_edge(2, 4, G); + add_edge(3, 1, G); + add_edge(3, 4, G); + add_edge(4, 0, G); + add_edge(4, 1, G); std::cout << "original graph:" << std::endl; - boost::print_graph(G, boost::get(boost::vertex_index, G)); + print_graph(G, get(vertex_index, G)); std::cout << std::endl << "reversed graph:" << std::endl; - boost::print_graph(boost::make_reverse_graph(G), - boost::get(boost::vertex_index, G)); - - + print_graph(make_reverse_graph(G), get(vertex_index, G)); return 0; } diff --git a/example/visitor.cpp b/example/visitor.cpp index 12860e7c..448bc818 100644 --- a/example/visitor.cpp +++ b/example/visitor.cpp @@ -114,7 +114,7 @@ main(int, char*[]) boost::breadth_first_search (G, vertex(0, G), make_bfs_visitor( std::make_pair(print_edge("tree", on_tree_edge()), - print_edge("cycle", on_cycle_edge()))), + print_edge("cycle", on_non_tree_edge()))), make_iterator_property_map(c.begin(), vertex_id, c[0])); return 0; diff --git a/include/boost/graph/detail/adjacency_iterator.hpp b/include/boost/graph/detail/adjacency_iterator.hpp deleted file mode 100644 index 1408b264..00000000 --- a/include/boost/graph/detail/adjacency_iterator.hpp +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef BOOST_DETAIL_ADJACENCY_ITERATOR_HPP -#define BOOST_DETAIL_ADJACENCY_ITERATOR_HPP - -#include - -namespace boost { - - namespace detail { - -#ifndef BOOST_NO_ITERATOR_ADAPTORS - template - struct adjacency_iterator_traits { - typedef Vertex value_type; - typedef value_type reference; - typedef value_type* pointer; - typedef boost::multi_pass_input_iterator_tag iterator_category; - typedef typename Traits::difference_type difference_type; - }; - - template - struct adjacency_iterator_policies : - public boost::default_iterator_policies - { - inline adjacency_iterator_policies() { } - inline adjacency_iterator_policies(Graph* g) : m_g(g) { } - - template - inline Reference - dereference(boost::type, const Iterator& i) const - { return target(*i, *m_g); } - - Graph* m_g; - }; - - template -#else - class Traits -#endif - > - struct adjacency_iterator { - typedef boost::iterator_adaptor, - adjacency_iterator_traits - > type; - }; -#else - template - struct bidir_adj_iter - : public boost::iterator - { - private: - typedef bidir_adj_iter self; - public: - typedef std::ptrdiff_t difference_type; - typedef boost::multi_pass_input_iterator_tag iterator_category; - typedef Vertex* pointer; - typedef Vertex reference; - typedef Vertex value_type; - inline bidir_adj_iter() { } - inline bidir_adj_iter(OutEdgeIter ii, Graph* _g) - : i(ii), g(_g) {} - - inline self& operator++() { ++i; return *this; } - inline self operator++(int) { self tmp = *this; ++(*this); return tmp; } - inline reference operator*() const { return target(*i, *g); } - /* Attention: */ - /* Even if two iterators are not equal, they could be the same vertex! */ - /* i.e. i != j does not mean *i != *j */ - - inline bool operator!=(const self& x) const { return i != x.i; } - inline bool operator==(const self& x) const { return i == x.i; } - - inline self* operator->() { return this; } - - OutEdgeIter& iter() { return i; } - const OutEdgeIter& iter() const { return i; } - - /* protected: */ - OutEdgeIter i; - Graph* g; - protected: - }; -#endif - - } // namespace detail - -} // namespace boost - -#endif // BOOST_DETAIL_ADJACENCY_ITERATOR_HPP diff --git a/include/boost/graph/edge_connectivity.hpp b/include/boost/graph/edge_connectivity.hpp index 164eadc6..22ac9499 100644 --- a/include/boost/graph/edge_connectivity.hpp +++ b/include/boost/graph/edge_connectivity.hpp @@ -139,13 +139,13 @@ namespace boost { //------------------------------------------------------------------------- // The Algorithm - tie(p, delta) = min_degree_vertex(g); + tie(p, delta) = detail::min_degree_vertex(g); S_star.push_back(p); alpha_star = delta; S.insert(p); neighbor_S.insert(p); - neighbors(g, S.begin(), S.end(), - std::inserter(neighbor_S, neighbor_S.begin())); + detail::neighbors(g, S.begin(), S.end(), + std::inserter(neighbor_S, neighbor_S.begin())); std::set_difference(vertices(g).first, vertices(g).second, neighbor_S.begin(), neighbor_S.end(), @@ -164,7 +164,7 @@ namespace boost { } S.insert(k); neighbor_S.insert(k); - neighbors(g, k, std::inserter(neighbor_S, neighbor_S.begin())); + detail::neighbors(g, k, std::inserter(neighbor_S, neighbor_S.begin())); non_neighbor_S.clear(); std::set_difference(vertices(g).first, vertices(g).second, neighbor_S.begin(), neighbor_S.end(), diff --git a/include/boost/graph/edmunds_karp_max_flow.hpp b/include/boost/graph/edmunds_karp_max_flow.hpp index 593ee81c..865d0449 100644 --- a/include/boost/graph/edmunds_karp_max_flow.hpp +++ b/include/boost/graph/edmunds_karp_max_flow.hpp @@ -1,3 +1,28 @@ +//======================================================================= +// Copyright 2000 University of Notre Dame. +// Authors: Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee +// +// This file is part of the Boost Graph Library +// +// You should have received a copy of the License Agreement for the +// Boost Graph Library along with the software; see the file LICENSE. +// If not, contact Office of Research, University of Notre Dame, Notre +// Dame, IN 46556. +// +// Permission to modify the code and to distribute modified code is +// granted, provided the text of this NOTICE is retained, a notice that +// the code was modified is included with the above COPYRIGHT NOTICE and +// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE +// file is distributed with the modified code. +// +// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. +// By way of example, but not limitation, Licensor MAKES NO +// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY +// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS +// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS +// OR OTHER RIGHTS. +//======================================================================= + #ifndef EDMUNDS_KARP_MAX_FLOW_HPP #define EDMUNDS_KARP_MAX_FLOW_HPP @@ -6,7 +31,7 @@ #include #include #include -#include +#include #include namespace boost { @@ -17,21 +42,10 @@ namespace boost { namespace detail { - template - struct is_residual_edge { - is_residual_edge() { } - is_residual_edge(ResCapMap r) : m_rcap(r) { } - template - bool operator()(const Edge& e) const { - return 0 < get(m_rcap, e); - } - ResCapMap m_rcap; - }; - template - filtered_edge_graph > + filtered_graph > residual_graph(Graph& g, ResCapMap residual_capacity) { - return filtered_edge_graph > + return filtered_graph > (g, is_residual_edge(residual_capacity)); }