mirror of
https://github.com/boostorg/graph.git
synced 2026-01-19 04:12:11 +00:00
Join ralf_grosse_kunstleve with HEAD
[SVN r9444]
This commit is contained in:
@@ -32,9 +32,9 @@ main(int,char*[])
|
||||
using namespace boost;
|
||||
{
|
||||
typedef GRAPH<int,int> Graph;
|
||||
REQUIRE(Graph, VertexListGraph);
|
||||
REQUIRE(Graph, BidirectionalGraph);
|
||||
REQUIRE(Graph, MutableGraph);
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
function_requires< BidirectionalGraphConcept<Graph> >();
|
||||
function_requires< MutableGraphConcept<Graph> >();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -34,33 +34,28 @@
|
||||
#include <boost/graph/reverse_graph.hpp>
|
||||
#include <boost/graph/graph_utility.hpp>
|
||||
|
||||
int
|
||||
main()
|
||||
int main()
|
||||
{
|
||||
typedef boost::adjacency_list<
|
||||
boost::vecS, boost::vecS, boost::bidirectionalS
|
||||
> Graph;
|
||||
using namespace boost;
|
||||
typedef adjacency_list<vecS, vecS, bidirectionalS> 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
#ifndef BOOST_DETAIL_ADJACENCY_ITERATOR_HPP
|
||||
#define BOOST_DETAIL_ADJACENCY_ITERATOR_HPP
|
||||
|
||||
#include <boost/pending/iterator_adaptors.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail {
|
||||
|
||||
#ifndef BOOST_NO_ITERATOR_ADAPTORS
|
||||
template <class Vertex, class Traits>
|
||||
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 <class Graph>
|
||||
struct adjacency_iterator_policies :
|
||||
public boost::default_iterator_policies
|
||||
{
|
||||
inline adjacency_iterator_policies() { }
|
||||
inline adjacency_iterator_policies(Graph* g) : m_g(g) { }
|
||||
|
||||
template <class Reference, class Iterator>
|
||||
inline Reference
|
||||
dereference(boost::type<Reference>, const Iterator& i) const
|
||||
{ return target(*i, *m_g); }
|
||||
|
||||
Graph* m_g;
|
||||
};
|
||||
|
||||
template <class Graph, class Vertex, class OutEdgeIter,
|
||||
#if !defined BOOST_NO_STD_ITERATOR_TRAITS
|
||||
class Traits = std::iterator_traits<OutEdgeIter>
|
||||
#else
|
||||
class Traits
|
||||
#endif
|
||||
>
|
||||
struct adjacency_iterator {
|
||||
typedef boost::iterator_adaptor<OutEdgeIter,
|
||||
adjacency_iterator_policies<Graph>,
|
||||
adjacency_iterator_traits<Vertex, Traits>
|
||||
> type;
|
||||
};
|
||||
#else
|
||||
template <class Vertex, class OutEdgeIter, class Graph>
|
||||
struct bidir_adj_iter
|
||||
: public boost::iterator<boost::multi_pass_input_iterator_tag, Vertex,
|
||||
std::ptrdiff_t, Vertex*, Vertex>
|
||||
{
|
||||
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
|
||||
@@ -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(),
|
||||
|
||||
@@ -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 <boost/property_map.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
#include <boost/graph/filtered_edge_graph.hpp>
|
||||
#include <boost/graph/filtered_graph.hpp>
|
||||
#include <boost/graph/breadth_first_search.hpp>
|
||||
|
||||
namespace boost {
|
||||
@@ -17,21 +42,10 @@ namespace boost {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <class ResCapMap>
|
||||
struct is_residual_edge {
|
||||
is_residual_edge() { }
|
||||
is_residual_edge(ResCapMap r) : m_rcap(r) { }
|
||||
template <class Edge>
|
||||
bool operator()(const Edge& e) const {
|
||||
return 0 < get(m_rcap, e);
|
||||
}
|
||||
ResCapMap m_rcap;
|
||||
};
|
||||
|
||||
template <class Graph, class ResCapMap>
|
||||
filtered_edge_graph<Graph, is_residual_edge<ResCapMap> >
|
||||
filtered_graph<Graph, is_residual_edge<ResCapMap> >
|
||||
residual_graph(Graph& g, ResCapMap residual_capacity) {
|
||||
return filtered_edge_graph<Graph, is_residual_edge<ResCapMap> >
|
||||
return filtered_graph<Graph, is_residual_edge<ResCapMap> >
|
||||
(g, is_residual_edge<ResCapMap>(residual_capacity));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user