mirror of
https://github.com/boostorg/graph.git
synced 2026-02-26 16:52:12 +00:00
Merged r76050, r75547, r75891, r76049, r76083, and r76439 from trunk (reverse_graph bug fixes and fix for #6293); refs #6293
[SVN r76535]
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#include <boost/graph/detail/d_ary_heap.hpp>
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
#include <boost/property_map/vector_property_map.hpp>
|
||||
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace boost {
|
||||
struct AStarHeuristicConcept {
|
||||
void constraints()
|
||||
{
|
||||
function_requires< CopyConstructibleConcept<Heuristic> >();
|
||||
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Heuristic> ));
|
||||
h(u);
|
||||
}
|
||||
Heuristic h;
|
||||
@@ -58,7 +58,7 @@ namespace boost {
|
||||
struct AStarVisitorConcept {
|
||||
void constraints()
|
||||
{
|
||||
function_requires< CopyConstructibleConcept<Visitor> >();
|
||||
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> ));
|
||||
vis.initialize_vertex(u, g);
|
||||
vis.discover_vertex(u, g);
|
||||
vis.examine_vertex(u, g);
|
||||
|
||||
@@ -29,13 +29,14 @@
|
||||
#include <boost/graph/relax.hpp>
|
||||
#include <boost/graph/visitors.hpp>
|
||||
#include <boost/graph/named_function_params.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class Visitor, class Graph>
|
||||
struct BellmanFordVisitorConcept {
|
||||
void constraints() {
|
||||
function_requires< CopyConstructibleConcept<Visitor> >();
|
||||
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> ));
|
||||
vis.examine_edge(e, g);
|
||||
vis.edge_relaxed(e, g);
|
||||
vis.edge_not_relaxed(e, g);
|
||||
@@ -95,12 +96,12 @@ namespace boost {
|
||||
BinaryPredicate compare,
|
||||
BellmanFordVisitor v)
|
||||
{
|
||||
function_requires<EdgeListGraphConcept<EdgeListGraph> >();
|
||||
BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<EdgeListGraph> ));
|
||||
typedef graph_traits<EdgeListGraph> GTraits;
|
||||
typedef typename GTraits::edge_descriptor Edge;
|
||||
typedef typename GTraits::vertex_descriptor Vertex;
|
||||
function_requires<ReadWritePropertyMapConcept<DistanceMap, Vertex> >();
|
||||
function_requires<ReadablePropertyMapConcept<WeightMap, Edge> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<DistanceMap, Vertex> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<WeightMap, Edge> ));
|
||||
typedef typename property_traits<DistanceMap>::value_type D_value;
|
||||
typedef typename property_traits<WeightMap>::value_type W_value;
|
||||
|
||||
@@ -229,7 +230,7 @@ namespace boost {
|
||||
(VertexAndEdgeListGraph& g,
|
||||
const bgl_named_params<P, T, R>& params)
|
||||
{
|
||||
function_requires<VertexListGraphConcept<VertexAndEdgeListGraph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<VertexAndEdgeListGraph> ));
|
||||
return detail::bellman_dispatch
|
||||
(g, num_vertices(g),
|
||||
choose_const_pmap(get_param(params, edge_weight), g, edge_weight),
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
#include <boost/graph/depth_first_search.hpp>
|
||||
#include <boost/graph/graph_utility.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -160,14 +161,14 @@ namespace boost
|
||||
{
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor vertex_t;
|
||||
typedef typename graph_traits<Graph>::edge_descriptor edge_t;
|
||||
function_requires<VertexListGraphConcept<Graph> >();
|
||||
function_requires<IncidenceGraphConcept<Graph> >();
|
||||
function_requires<WritablePropertyMapConcept<ComponentMap, edge_t> >();
|
||||
function_requires<ReadWritePropertyMapConcept<DiscoverTimeMap,
|
||||
vertex_t> >();
|
||||
function_requires<ReadWritePropertyMapConcept<LowPointMap, vertex_t > >();
|
||||
function_requires<ReadWritePropertyMapConcept<PredecessorMap,
|
||||
vertex_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<ComponentMap, edge_t> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<DiscoverTimeMap,
|
||||
vertex_t> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<LowPointMap, vertex_t > ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<PredecessorMap,
|
||||
vertex_t> ));
|
||||
|
||||
std::size_t num_components = 0;
|
||||
std::size_t dfs_time = 0;
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/graph/named_function_params.hpp>
|
||||
#include <boost/graph/lookup_edge.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
// The algorithm impelemented here is described in:
|
||||
//
|
||||
@@ -743,16 +744,16 @@ boykov_kolmogorov_max_flow(Graph& g,
|
||||
typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor;
|
||||
|
||||
//as this method is the last one before we instantiate the solver, we do the concept checks here
|
||||
function_requires<VertexListGraphConcept<Graph> >(); //to have vertices(), num_vertices(),
|
||||
function_requires<EdgeListGraphConcept<Graph> >(); //to have edges()
|
||||
function_requires<IncidenceGraphConcept<Graph> >(); //to have source(), target() and out_edges()
|
||||
function_requires<ReadablePropertyMapConcept<CapacityEdgeMap, edge_descriptor> >(); //read flow-values from edges
|
||||
function_requires<ReadWritePropertyMapConcept<ResidualCapacityEdgeMap, edge_descriptor> >(); //write flow-values to residuals
|
||||
function_requires<ReadablePropertyMapConcept<ReverseEdgeMap, edge_descriptor> >(); //read out reverse edges
|
||||
function_requires<ReadWritePropertyMapConcept<PredecessorMap, vertex_descriptor> >(); //store predecessor there
|
||||
function_requires<ReadWritePropertyMapConcept<ColorMap, vertex_descriptor> >(); //write corresponding tree
|
||||
function_requires<ReadWritePropertyMapConcept<DistanceMap, vertex_descriptor> >(); //write distance to source/sink
|
||||
function_requires<ReadablePropertyMapConcept<IndexMap, vertex_descriptor> >(); //get index 0...|V|-1
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> )); //to have vertices(), num_vertices(),
|
||||
BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> )); //to have edges()
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> )); //to have source(), target() and out_edges()
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<CapacityEdgeMap, edge_descriptor> )); //read flow-values from edges
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<ResidualCapacityEdgeMap, edge_descriptor> )); //write flow-values to residuals
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<ReverseEdgeMap, edge_descriptor> )); //read out reverse edges
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<PredecessorMap, vertex_descriptor> )); //store predecessor there
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<ColorMap, vertex_descriptor> )); //write corresponding tree
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<DistanceMap, vertex_descriptor> )); //write distance to source/sink
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<IndexMap, vertex_descriptor> )); //get index 0...|V|-1
|
||||
BOOST_ASSERT(num_vertices(g) >= 2 && src != sink);
|
||||
|
||||
detail::bk_max_flow<
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <boost/graph/overloading.hpp>
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/graph/two_bit_color_map.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
#ifdef BOOST_GRAPH_USE_MPI
|
||||
#include <boost/graph/distributed/concepts.hpp>
|
||||
@@ -34,7 +35,7 @@ namespace boost {
|
||||
template <class Visitor, class Graph>
|
||||
struct BFSVisitorConcept {
|
||||
void constraints() {
|
||||
function_requires< CopyConstructibleConcept<Visitor> >();
|
||||
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> ));
|
||||
vis.initialize_vertex(u, g);
|
||||
vis.discover_vertex(u, g);
|
||||
vis.examine_vertex(u, g);
|
||||
@@ -59,12 +60,12 @@ namespace boost {
|
||||
typename graph_traits<IncidenceGraph>::vertex_descriptor s,
|
||||
Buffer& Q, BFSVisitor vis, ColorMap color)
|
||||
{
|
||||
function_requires< IncidenceGraphConcept<IncidenceGraph> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<IncidenceGraph> ));
|
||||
typedef graph_traits<IncidenceGraph> GTraits;
|
||||
typedef typename GTraits::vertex_descriptor Vertex;
|
||||
typedef typename GTraits::edge_descriptor Edge;
|
||||
function_requires< BFSVisitorConcept<BFSVisitor, IncidenceGraph> >();
|
||||
function_requires< ReadWritePropertyMapConcept<ColorMap, Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( BFSVisitorConcept<BFSVisitor, IncidenceGraph> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<ColorMap, Vertex> ));
|
||||
typedef typename property_traits<ColorMap>::value_type ColorValue;
|
||||
typedef color_traits<ColorValue> Color;
|
||||
typename GTraits::out_edge_iterator ei, ei_end;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <deque>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/graph/lookup_edge.hpp>
|
||||
|
||||
@@ -151,7 +153,7 @@ namespace detail
|
||||
const Container& in,
|
||||
Container& out)
|
||||
{
|
||||
function_requires< GraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<Graph> ));
|
||||
|
||||
typename graph_traits<Graph>::directed_category cat;
|
||||
typename Container::const_iterator i, end = in.end();
|
||||
@@ -174,8 +176,8 @@ namespace detail
|
||||
Visitor vis,
|
||||
std::size_t min)
|
||||
{
|
||||
function_requires< GraphConcept<Graph> >();
|
||||
function_requires< CliqueVisitorConcept<Visitor,Clique,Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( CliqueVisitorConcept<Visitor,Clique,Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
|
||||
// Is there vertex in nots that is connected to all vertices
|
||||
@@ -266,15 +268,15 @@ template <typename Graph, typename Visitor>
|
||||
inline void
|
||||
bron_kerbosch_all_cliques(const Graph& g, Visitor vis, std::size_t min)
|
||||
{
|
||||
function_requires< IncidenceGraphConcept<Graph> >();
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
function_requires< VertexIndexGraphConcept<Graph> >();
|
||||
function_requires< AdjacencyMatrixConcept<Graph> >(); // Structural requirement only
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( VertexIndexGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept<Graph> )); // Structural requirement only
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
|
||||
typedef std::vector<Vertex> VertexSet;
|
||||
typedef std::deque<Vertex> Clique;
|
||||
function_requires< CliqueVisitorConcept<Visitor,Clique,Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( CliqueVisitorConcept<Visitor,Clique,Graph> ));
|
||||
|
||||
// NOTE: We're using a deque to implement the clique, because it provides
|
||||
// constant inserts and removals at the end and also a constant size.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <boost/graph/detail/geodesic.hpp>
|
||||
#include <boost/graph/exterior_property.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -25,9 +26,9 @@ struct closeness_measure
|
||||
|
||||
result_type operator ()(distance_type d, const Graph&)
|
||||
{
|
||||
function_requires< NumericValueConcept<DistanceType> >();
|
||||
function_requires< NumericValueConcept<ResultType> >();
|
||||
function_requires< AdaptableUnaryFunctionConcept<Reciprocal,ResultType,ResultType> >();
|
||||
BOOST_CONCEPT_ASSERT(( NumericValueConcept<DistanceType> ));
|
||||
BOOST_CONCEPT_ASSERT(( NumericValueConcept<ResultType> ));
|
||||
BOOST_CONCEPT_ASSERT(( AdaptableUnaryFunctionConcept<Reciprocal,ResultType,ResultType> ));
|
||||
return (d == base_type::infinite_distance())
|
||||
? base_type::zero_result()
|
||||
: rec(result_type(d));
|
||||
@@ -75,12 +76,12 @@ closeness_centrality(const Graph& g,
|
||||
Measure measure,
|
||||
Combinator combine)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMap,Vertex> ));
|
||||
typedef typename property_traits<DistanceMap>::value_type Distance;
|
||||
function_requires< NumericValueConcept<Distance> >();
|
||||
function_requires< DistanceMeasureConcept<Measure,Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( NumericValueConcept<Distance> ));
|
||||
BOOST_CONCEPT_ASSERT(( DistanceMeasureConcept<Measure,Graph> ));
|
||||
|
||||
Distance n = detail::combine_distances(g, dist, combine, Distance(0));
|
||||
return measure(n, g);
|
||||
@@ -90,9 +91,9 @@ template <typename Graph, typename DistanceMap, typename Measure>
|
||||
inline typename Measure::result_type
|
||||
closeness_centrality(const Graph& g, DistanceMap dist, Measure measure)
|
||||
{
|
||||
function_requires< GraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMap,Vertex> ));
|
||||
typedef typename property_traits<DistanceMap>::value_type Distance;
|
||||
|
||||
return closeness_centrality(g, dist, measure, std::plus<Distance>());
|
||||
@@ -116,12 +117,12 @@ all_closeness_centralities(const Graph& g,
|
||||
CentralityMap cent,
|
||||
Measure measure)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> ));
|
||||
typedef typename property_traits<DistanceMatrixMap>::value_type DistanceMap;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >();
|
||||
function_requires< WritablePropertyMapConcept<CentralityMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMap,Vertex> ));
|
||||
BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<CentralityMap,Vertex> ));
|
||||
typedef typename property_traits<DistanceMap>::value_type Distance;
|
||||
typedef typename property_traits<CentralityMap>::value_type Centrality;
|
||||
|
||||
@@ -141,11 +142,11 @@ all_closeness_centralities(const Graph& g,
|
||||
DistanceMatrixMap dist,
|
||||
CentralityMap cent)
|
||||
{
|
||||
function_requires< GraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> ));
|
||||
typedef typename property_traits<DistanceMatrixMap>::value_type DistanceMap;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMap,Vertex> ));
|
||||
typedef typename property_traits<DistanceMap>::value_type Distance;
|
||||
typedef typename property_traits<CentralityMap>::value_type Result;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/graph/lookup_edge.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -20,7 +21,7 @@ namespace detail
|
||||
inline typename graph_traits<Graph>::degree_size_type
|
||||
possible_edges(const Graph& g, std::size_t k, directed_tag)
|
||||
{
|
||||
function_requires< GraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::degree_size_type T;
|
||||
return T(k) * (T(k) - 1);
|
||||
}
|
||||
@@ -42,7 +43,7 @@ namespace detail
|
||||
directed_tag)
|
||||
|
||||
{
|
||||
function_requires< AdjacencyMatrixConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept<Graph> ));
|
||||
return (lookup_edge(u, v, g).second ? 1 : 0) +
|
||||
(lookup_edge(v, u, g).second ? 1 : 0);
|
||||
}
|
||||
@@ -55,7 +56,7 @@ namespace detail
|
||||
typename graph_traits<Graph>::vertex_descriptor v,
|
||||
undirected_tag)
|
||||
{
|
||||
function_requires< AdjacencyMatrixConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept<Graph> ));
|
||||
return lookup_edge(u, v, g).second ? 1 : 0;
|
||||
}
|
||||
}
|
||||
@@ -64,7 +65,7 @@ template <typename Graph, typename Vertex>
|
||||
inline typename graph_traits<Graph>::degree_size_type
|
||||
num_paths_through_vertex(const Graph& g, Vertex v)
|
||||
{
|
||||
function_requires< AdjacencyGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::directed_category Directed;
|
||||
typedef typename graph_traits<Graph>::adjacency_iterator AdjacencyIterator;
|
||||
|
||||
@@ -81,8 +82,8 @@ template <typename Graph, typename Vertex>
|
||||
inline typename graph_traits<Graph>::degree_size_type
|
||||
num_triangles_on_vertex(const Graph& g, Vertex v)
|
||||
{
|
||||
function_requires< IncidenceGraphConcept<Graph> >();
|
||||
function_requires< AdjacencyGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::degree_size_type Degree;
|
||||
typedef typename graph_traits<Graph>::directed_category Directed;
|
||||
typedef typename graph_traits<Graph>::adjacency_iterator AdjacencyIterator;
|
||||
@@ -119,10 +120,10 @@ template <typename Graph, typename ClusteringMap>
|
||||
inline typename property_traits<ClusteringMap>::value_type
|
||||
all_clustering_coefficients(const Graph& g, ClusteringMap cm)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
|
||||
function_requires< WritablePropertyMapConcept<ClusteringMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<ClusteringMap,Vertex> ));
|
||||
typedef typename property_traits<ClusteringMap>::value_type Coefficient;
|
||||
|
||||
Coefficient sum(0);
|
||||
@@ -139,10 +140,10 @@ template <typename Graph, typename ClusteringMap>
|
||||
inline typename property_traits<ClusteringMap>::value_type
|
||||
mean_clustering_coefficient(const Graph& g, ClusteringMap cm)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
|
||||
function_requires< ReadablePropertyMapConcept<ClusteringMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<ClusteringMap,Vertex> ));
|
||||
typedef typename property_traits<ClusteringMap>::value_type Coefficient;
|
||||
|
||||
Coefficient cc(0);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/graph/overloading.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -64,7 +65,7 @@ namespace boost {
|
||||
if (num_vertices(g) == 0) return 0;
|
||||
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
function_requires< WritablePropertyMapConcept<ComponentMap, Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<ComponentMap, Vertex> ));
|
||||
typedef typename boost::graph_traits<Graph>::directed_category directed;
|
||||
BOOST_STATIC_ASSERT((boost::is_same<directed, undirected_tag>::value));
|
||||
|
||||
@@ -84,7 +85,7 @@ namespace boost {
|
||||
if (num_vertices(g) == 0) return 0;
|
||||
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
function_requires< WritablePropertyMapConcept<ComponentMap, Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<ComponentMap, Vertex> ));
|
||||
typedef typename boost::graph_traits<Graph>::directed_category directed;
|
||||
// BOOST_STATIC_ASSERT((boost::is_same<directed, undirected_tag>::value));
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <vector>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/reverse_graph.hpp>
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
#include <boost/graph/named_function_params.hpp>
|
||||
#include <boost/graph/breadth_first_search.hpp>
|
||||
@@ -53,6 +54,21 @@ namespace boost {
|
||||
|
||||
namespace detail {
|
||||
|
||||
// Hack to make transpose_graph work with the same interface as before
|
||||
template <typename Graph, typename Desc>
|
||||
struct remove_reverse_edge_descriptor {
|
||||
typedef Desc type;
|
||||
static Desc convert(const Desc& d, const Graph&) {return d;}
|
||||
};
|
||||
|
||||
template <typename Graph, typename Desc>
|
||||
struct remove_reverse_edge_descriptor<Graph, reverse_graph_edge_descriptor<Desc> > {
|
||||
typedef Desc type;
|
||||
static Desc convert(const reverse_graph_edge_descriptor<Desc>& d, const Graph& g) {
|
||||
return get(edge_underlying, g, d);
|
||||
}
|
||||
};
|
||||
|
||||
// Default edge and vertex property copiers
|
||||
|
||||
template <typename Graph1, typename Graph2>
|
||||
@@ -112,6 +128,7 @@ namespace boost {
|
||||
CopyVertex copy_vertex, CopyEdge copy_edge,
|
||||
Orig2CopyVertexIndexMap orig2copy, IndexMap)
|
||||
{
|
||||
typedef remove_reverse_edge_descriptor<Graph, typename graph_traits<Graph>::edge_descriptor> cvt;
|
||||
typename graph_traits<Graph>::vertex_iterator vi, vi_end;
|
||||
for (boost::tie(vi, vi_end) = vertices(g_in); vi != vi_end; ++vi) {
|
||||
typename graph_traits<MutableGraph>::vertex_descriptor
|
||||
@@ -126,7 +143,7 @@ namespace boost {
|
||||
boost::tie(new_e, inserted) = add_edge(get(orig2copy, source(*ei, g_in)),
|
||||
get(orig2copy, target(*ei, g_in)),
|
||||
g_out);
|
||||
copy_edge(*ei, new_e);
|
||||
copy_edge(cvt::convert(*ei, g_in), new_e);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -141,6 +158,7 @@ namespace boost {
|
||||
CopyVertex copy_vertex, CopyEdge copy_edge,
|
||||
Orig2CopyVertexIndexMap orig2copy, IndexMap)
|
||||
{
|
||||
typedef remove_reverse_edge_descriptor<Graph, typename graph_traits<Graph>::edge_descriptor> cvt;
|
||||
typename graph_traits<Graph>::vertex_iterator vi, vi_end;
|
||||
for (boost::tie(vi, vi_end) = vertices(g_in); vi != vi_end; ++vi) {
|
||||
typename graph_traits<MutableGraph>::vertex_descriptor
|
||||
@@ -156,7 +174,7 @@ namespace boost {
|
||||
boost::tie(new_e, inserted) = add_edge(get(orig2copy, source(*ei, g_in)),
|
||||
get(orig2copy, target(*ei, g_in)),
|
||||
g_out);
|
||||
copy_edge(*ei, new_e);
|
||||
copy_edge(cvt::convert(*ei, g_in), new_e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,6 +191,7 @@ namespace boost {
|
||||
Orig2CopyVertexIndexMap orig2copy,
|
||||
IndexMap index_map)
|
||||
{
|
||||
typedef remove_reverse_edge_descriptor<Graph, typename graph_traits<Graph>::edge_descriptor> cvt;
|
||||
typedef color_traits<default_color_type> Color;
|
||||
std::vector<default_color_type>
|
||||
color(num_vertices(g_in), Color::white());
|
||||
@@ -192,7 +211,7 @@ namespace boost {
|
||||
boost::tie(new_e, inserted) = add_edge(get(orig2copy, source(*ei,g_in)),
|
||||
get(orig2copy, target(*ei,g_in)),
|
||||
g_out);
|
||||
copy_edge(*ei, new_e);
|
||||
copy_edge(cvt::convert(*ei, g_in), new_e);
|
||||
}
|
||||
}
|
||||
color[get(index_map, *vi)] = Color::black();
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <boost/pending/indirect_cmp.hpp>
|
||||
#include <boost/graph/breadth_first_search.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
/*
|
||||
* core_numbers
|
||||
@@ -46,7 +47,7 @@ namespace boost {
|
||||
struct CoreNumbersVisitorConcept {
|
||||
void constraints()
|
||||
{
|
||||
function_requires< CopyConstructibleConcept<Visitor> >();
|
||||
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> ));
|
||||
vis.examine_vertex(u,g);
|
||||
vis.finish_vertex(u,g);
|
||||
vis.examine_edge(e,g);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define BOOST_GRAPH_DEGREE_CENTRALITY_HPP
|
||||
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -28,7 +29,7 @@ struct influence_measure
|
||||
|
||||
inline degree_type operator ()(vertex_type v, const Graph& g)
|
||||
{
|
||||
function_requires< IncidenceGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
|
||||
return out_degree(v, g);
|
||||
}
|
||||
};
|
||||
@@ -49,7 +50,7 @@ struct prestige_measure
|
||||
|
||||
inline degree_type operator ()(vertex_type v, const Graph& g)
|
||||
{
|
||||
function_requires< BidirectionalGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
|
||||
return in_degree(v, g);
|
||||
}
|
||||
};
|
||||
@@ -64,7 +65,7 @@ template <typename Graph, typename Vertex, typename Measure>
|
||||
inline typename Measure::degree_type
|
||||
degree_centrality(const Graph& g, Vertex v, Measure measure)
|
||||
{
|
||||
function_requires< DegreeMeasureConcept<Measure, Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( DegreeMeasureConcept<Measure, Graph> ));
|
||||
return measure(v, g);
|
||||
}
|
||||
|
||||
@@ -94,10 +95,10 @@ template <typename Graph, typename CentralityMap, typename Measure>
|
||||
inline void
|
||||
all_degree_centralities(const Graph& g, CentralityMap cent, Measure measure)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
|
||||
function_requires< WritablePropertyMapConcept<CentralityMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<CentralityMap,Vertex> ));
|
||||
typedef typename property_traits<CentralityMap>::value_type Centrality;
|
||||
|
||||
VertexIterator i, end;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <boost/graph/named_function_params.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/implicit_cast.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
@@ -31,7 +32,7 @@ namespace boost {
|
||||
class DFSVisitorConcept {
|
||||
public:
|
||||
void constraints() {
|
||||
function_requires< CopyConstructibleConcept<Visitor> >();
|
||||
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> ));
|
||||
vis.initialize_vertex(u, g);
|
||||
vis.start_vertex(u, g);
|
||||
vis.discover_vertex(u, g);
|
||||
@@ -80,12 +81,12 @@ namespace boost {
|
||||
DFSVisitor& vis,
|
||||
ColorMap color, TerminatorFunc func = TerminatorFunc())
|
||||
{
|
||||
function_requires<IncidenceGraphConcept<IncidenceGraph> >();
|
||||
function_requires<DFSVisitorConcept<DFSVisitor, IncidenceGraph> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<IncidenceGraph> ));
|
||||
BOOST_CONCEPT_ASSERT(( DFSVisitorConcept<DFSVisitor, IncidenceGraph> ));
|
||||
typedef typename graph_traits<IncidenceGraph>::vertex_descriptor Vertex;
|
||||
function_requires< ReadWritePropertyMapConcept<ColorMap, Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<ColorMap, Vertex> ));
|
||||
typedef typename property_traits<ColorMap>::value_type ColorValue;
|
||||
function_requires< ColorValueConcept<ColorValue> >();
|
||||
BOOST_CONCEPT_ASSERT(( ColorValueConcept<ColorValue> ));
|
||||
typedef color_traits<ColorValue> Color;
|
||||
typedef typename graph_traits<IncidenceGraph>::out_edge_iterator Iter;
|
||||
typedef std::pair<Vertex, std::pair<Iter, Iter> > VertexInfo;
|
||||
@@ -151,12 +152,12 @@ namespace boost {
|
||||
DFSVisitor& vis, // pass-by-reference here, important!
|
||||
ColorMap color, TerminatorFunc func)
|
||||
{
|
||||
function_requires<IncidenceGraphConcept<IncidenceGraph> >();
|
||||
function_requires<DFSVisitorConcept<DFSVisitor, IncidenceGraph> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<IncidenceGraph> ));
|
||||
BOOST_CONCEPT_ASSERT(( DFSVisitorConcept<DFSVisitor, IncidenceGraph> ));
|
||||
typedef typename graph_traits<IncidenceGraph>::vertex_descriptor Vertex;
|
||||
function_requires< ReadWritePropertyMapConcept<ColorMap, Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<ColorMap, Vertex> ));
|
||||
typedef typename property_traits<ColorMap>::value_type ColorValue;
|
||||
function_requires< ColorValueConcept<ColorValue> >();
|
||||
BOOST_CONCEPT_ASSERT(( ColorValueConcept<ColorValue> ));
|
||||
typedef color_traits<ColorValue> Color;
|
||||
typename graph_traits<IncidenceGraph>::out_edge_iterator ei, ei_end;
|
||||
|
||||
@@ -187,7 +188,7 @@ namespace boost {
|
||||
typename graph_traits<VertexListGraph>::vertex_descriptor start_vertex)
|
||||
{
|
||||
typedef typename graph_traits<VertexListGraph>::vertex_descriptor Vertex;
|
||||
function_requires<DFSVisitorConcept<DFSVisitor, VertexListGraph> >();
|
||||
BOOST_CONCEPT_ASSERT(( DFSVisitorConcept<DFSVisitor, VertexListGraph> ));
|
||||
typedef typename property_traits<ColorMap>::value_type ColorValue;
|
||||
typedef color_traits<ColorValue> Color;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/graph/numeric_values.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
// TODO: Should this really be in detail?
|
||||
|
||||
@@ -51,13 +52,13 @@ namespace detail {
|
||||
Combinator combine,
|
||||
Distance init)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >();
|
||||
function_requires< NumericValueConcept<Distance> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMap,Vertex> ));
|
||||
BOOST_CONCEPT_ASSERT(( NumericValueConcept<Distance> ));
|
||||
typedef numeric_values<Distance> DistanceNumbers;
|
||||
function_requires< AdaptableBinaryFunction<Combinator,Distance,Distance,Distance> >();
|
||||
BOOST_CONCEPT_ASSERT(( AdaptableBinaryFunction<Combinator,Distance,Distance,Distance> ));
|
||||
|
||||
// If there's ever an infinite distance, then we simply return
|
||||
// infinity. Note that this /will/ include the a non-zero
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
#include <boost/property_map/vector_property_map.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
#ifdef BOOST_GRAPH_DIJKSTRA_TESTING
|
||||
# include <boost/pending/mutable_queue.hpp>
|
||||
@@ -68,7 +69,7 @@ namespace boost {
|
||||
template <class Visitor, class Graph>
|
||||
struct DijkstraVisitorConcept {
|
||||
void constraints() {
|
||||
function_requires< CopyConstructibleConcept<Visitor> >();
|
||||
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> ));
|
||||
vis.initialize_vertex(u, g);
|
||||
vis.discover_vertex(u, g);
|
||||
vis.examine_vertex(u, g);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <deque>
|
||||
#include <set>
|
||||
#include <boost/graph/depth_first_search.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
// Dominator tree computation
|
||||
|
||||
@@ -244,7 +245,7 @@ namespace boost {
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::vertices_size_type VerticesSizeType;
|
||||
|
||||
function_requires< BidirectionalGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
|
||||
|
||||
const VerticesSizeType numOfVertices = num_vertices(g);
|
||||
if (numOfVertices == 0) return;
|
||||
@@ -299,7 +300,7 @@ namespace boost {
|
||||
// Typedefs and concept check
|
||||
typedef typename graph_traits<Graph>::vertices_size_type VerticesSizeType;
|
||||
|
||||
function_requires< BidirectionalGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
|
||||
|
||||
// 1. Depth first visit
|
||||
const VerticesSizeType numOfVertices = num_vertices(g);
|
||||
@@ -388,7 +389,7 @@ namespace boost {
|
||||
iterator_property_map<typename std::vector< std::set<Vertex> >::iterator,
|
||||
IndexMap> vertexSetMap;
|
||||
|
||||
function_requires<BidirectionalGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
|
||||
|
||||
// 1. Finding dominator
|
||||
// 1.1. Initialize
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/graph/detail/geodesic.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -19,9 +20,9 @@ template <typename Graph,
|
||||
inline typename property_traits<DistanceMap>::value_type
|
||||
eccentricity(const Graph& g, DistanceMap dist, Combinator combine)
|
||||
{
|
||||
function_requires< GraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMap,Vertex> ));
|
||||
typedef typename property_traits<DistanceMap>::value_type Distance;
|
||||
|
||||
return detail::combine_distances(g, dist, combine, Distance(0));
|
||||
@@ -31,9 +32,9 @@ template <typename Graph, typename DistanceMap>
|
||||
inline typename property_traits<DistanceMap>::value_type
|
||||
eccentricity(const Graph& g, DistanceMap dist)
|
||||
{
|
||||
function_requires< GraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMap,Vertex> ));
|
||||
typedef typename property_traits<DistanceMap>::value_type Distance;
|
||||
|
||||
return eccentricity(g, dist, detail::maximize<Distance>());
|
||||
@@ -44,12 +45,12 @@ inline std::pair<typename property_traits<EccentricityMap>::value_type,
|
||||
typename property_traits<EccentricityMap>::value_type>
|
||||
all_eccentricities(const Graph& g, const DistanceMatrix& dist, EccentricityMap ecc)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMatrix,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMatrix,Vertex> ));
|
||||
typedef typename property_traits<DistanceMatrix>::value_type DistanceMap;
|
||||
function_requires< WritablePropertyMapConcept<EccentricityMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<EccentricityMap,Vertex> ));
|
||||
typedef typename property_traits<EccentricityMap>::value_type Eccentricity;
|
||||
BOOST_USING_STD_MIN();
|
||||
BOOST_USING_STD_MAX();
|
||||
@@ -76,10 +77,10 @@ inline std::pair<typename property_traits<EccentricityMap>::value_type,
|
||||
typename property_traits<EccentricityMap>::value_type>
|
||||
radius_and_diameter(const Graph& g, EccentricityMap ecc)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
|
||||
function_requires< ReadablePropertyMapConcept<EccentricityMap, Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<EccentricityMap, Vertex> ));
|
||||
typedef typename property_traits<EccentricityMap>::value_type Eccentricity;
|
||||
BOOST_USING_STD_MIN();
|
||||
BOOST_USING_STD_MAX();
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <boost/graph/named_function_params.hpp>
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/graph/relax.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -84,7 +85,7 @@ namespace boost
|
||||
const BinaryFunction& combine, const Infinity& inf,
|
||||
const Zero& zero)
|
||||
{
|
||||
function_requires<VertexListGraphConcept<VertexListGraph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<VertexListGraph> ));
|
||||
|
||||
return detail::floyd_warshall_dispatch(g, d, compare, combine,
|
||||
inf, zero);
|
||||
@@ -101,9 +102,9 @@ namespace boost
|
||||
const BinaryPredicate& compare, const BinaryFunction& combine,
|
||||
const Infinity& inf, const Zero& zero)
|
||||
{
|
||||
function_requires<VertexListGraphConcept<VertexAndEdgeListGraph> >();
|
||||
function_requires<EdgeListGraphConcept<VertexAndEdgeListGraph> >();
|
||||
function_requires<IncidenceGraphConcept<VertexAndEdgeListGraph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<VertexAndEdgeListGraph> ));
|
||||
BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<VertexAndEdgeListGraph> ));
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<VertexAndEdgeListGraph> ));
|
||||
|
||||
typename graph_traits<VertexAndEdgeListGraph>::vertex_iterator
|
||||
firstv, lastv, firstv2, lastv2;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <boost/graph/detail/geodesic.hpp>
|
||||
#include <boost/graph/exterior_property.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -25,10 +26,10 @@ struct mean_geodesic_measure
|
||||
|
||||
result_type operator ()(distance_type d, const Graph& g)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
function_requires< NumericValueConcept<DistanceType> >();
|
||||
function_requires< NumericValueConcept<ResultType> >();
|
||||
function_requires< AdaptableBinaryFunctionConcept<Divides,ResultType,ResultType,ResultType> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( NumericValueConcept<DistanceType> ));
|
||||
BOOST_CONCEPT_ASSERT(( NumericValueConcept<ResultType> ));
|
||||
BOOST_CONCEPT_ASSERT(( AdaptableBinaryFunctionConcept<Divides,ResultType,ResultType,ResultType> ));
|
||||
|
||||
return (d == base_type::infinite_distance())
|
||||
? base_type::infinite_result()
|
||||
@@ -69,8 +70,8 @@ struct mean_graph_distance_measure
|
||||
|
||||
inline result_type operator ()(distance_type d, const Graph& g)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
function_requires< NumericValueConcept<DistanceType> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( NumericValueConcept<DistanceType> ));
|
||||
|
||||
if(d == base_type::infinite_distance()) {
|
||||
return base_type::infinite_result();
|
||||
@@ -99,7 +100,7 @@ mean_geodesic(const Graph& g,
|
||||
Measure measure,
|
||||
Combinator combine)
|
||||
{
|
||||
function_requires< DistanceMeasureConcept<Measure,Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( DistanceMeasureConcept<Measure,Graph> ));
|
||||
typedef typename Measure::distance_type Distance;
|
||||
|
||||
Distance n = detail::combine_distances(g, dist, combine, Distance(0));
|
||||
@@ -112,7 +113,7 @@ template <typename Graph,
|
||||
inline typename Measure::result_type
|
||||
mean_geodesic(const Graph& g, DistanceMap dist, Measure measure)
|
||||
{
|
||||
function_requires< DistanceMeasureConcept<Measure,Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( DistanceMeasureConcept<Measure,Graph> ));
|
||||
typedef typename Measure::distance_type Distance;
|
||||
|
||||
return mean_geodesic(g, dist, measure, std::plus<Distance>());
|
||||
@@ -139,15 +140,15 @@ all_mean_geodesics(const Graph& g,
|
||||
GeodesicMap geo,
|
||||
Measure measure)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> ));
|
||||
typedef typename property_traits<DistanceMatrixMap>::value_type DistanceMap;
|
||||
function_requires< DistanceMeasureConcept<Measure,Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( DistanceMeasureConcept<Measure,Graph> ));
|
||||
typedef typename Measure::result_type Result;
|
||||
function_requires< WritablePropertyMapConcept<GeodesicMap,Vertex> >();
|
||||
function_requires< NumericValueConcept<Result> >();
|
||||
BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<GeodesicMap,Vertex> ));
|
||||
BOOST_CONCEPT_ASSERT(( NumericValueConcept<Result> ));
|
||||
|
||||
// NOTE: We could compute the mean geodesic here by performing additional
|
||||
// computations (i.e., adding and dividing). However, I don't really feel
|
||||
@@ -178,11 +179,11 @@ template <typename Graph, typename DistanceMatrixMap, typename GeodesicMap>
|
||||
inline typename property_traits<GeodesicMap>::value_type
|
||||
all_mean_geodesics(const Graph& g, DistanceMatrixMap dist, GeodesicMap geo)
|
||||
{
|
||||
function_requires< GraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
function_requires< ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> ));
|
||||
typedef typename property_traits<DistanceMatrixMap>::value_type DistanceMap;
|
||||
function_requires< WritablePropertyMapConcept<GeodesicMap,Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<GeodesicMap,Vertex> ));
|
||||
typedef typename property_traits<GeodesicMap>::value_type Result;
|
||||
|
||||
return all_mean_geodesics(g, dist, geo, measure_mean_geodesic<Result>(g, DistanceMap()));
|
||||
@@ -193,7 +194,7 @@ template <typename Graph, typename GeodesicMap, typename Measure>
|
||||
inline typename Measure::result_type
|
||||
small_world_distance(const Graph& g, GeodesicMap geo, Measure measure)
|
||||
{
|
||||
function_requires< DistanceMeasureConcept<Measure,Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( DistanceMeasureConcept<Measure,Graph> ));
|
||||
typedef typename Measure::result_type Result;
|
||||
|
||||
Result sum = detail::combine_distances(g, geo, std::plus<Result>(), Result(0));
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <boost/graph/buffer_concepts.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
#include <boost/concept/detail/concept_def.hpp>
|
||||
namespace boost
|
||||
@@ -529,8 +530,8 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&);
|
||||
{
|
||||
BOOST_CONCEPT_USAGE(NumericValue)
|
||||
{
|
||||
function_requires< DefaultConstructible<Numeric> >();
|
||||
function_requires< CopyConstructible<Numeric> >();
|
||||
BOOST_CONCEPT_ASSERT(( DefaultConstructible<Numeric> ));
|
||||
BOOST_CONCEPT_ASSERT(( CopyConstructible<Numeric> ));
|
||||
numeric_values<Numeric>::zero();
|
||||
numeric_values<Numeric>::infinity();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
/** @file howard_cycle_ratio.hpp
|
||||
* @brief The implementation of the maximum/minimum cycle ratio/mean algorithm.
|
||||
@@ -477,13 +478,13 @@ namespace boost {
|
||||
{
|
||||
typedef typename graph_traits<TG>::directed_category DirCat;
|
||||
BOOST_STATIC_ASSERT((is_convertible<DirCat*, directed_tag*>::value == true));
|
||||
function_requires< IncidenceGraphConcept<TG> >();
|
||||
function_requires< VertexListGraphConcept<TG> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<TG> ));
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<TG> ));
|
||||
typedef typename graph_traits<TG>::vertex_descriptor Vertex;
|
||||
function_requires< ReadablePropertyMapConcept<TVIM, Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<TVIM, Vertex> ));
|
||||
typedef typename graph_traits<TG>::edge_descriptor Edge;
|
||||
function_requires< ReadablePropertyMapConcept<TEW1, Edge> >();
|
||||
function_requires< ReadablePropertyMapConcept<TEW2, Edge> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<TEW1, Edge> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<TEW2, Edge> ));
|
||||
|
||||
if(pcc == 0) {
|
||||
return detail::mcr_howard<FT,TG, TVIM, TEW1, TEW2>(
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/detail/algorithm.hpp>
|
||||
#include <boost/pending/indirect_cmp.hpp> // for make_indirect_pmap
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
#ifndef BOOST_GRAPH_ITERATION_MACROS_HPP
|
||||
#define BOOST_ISO_INCLUDED_ITER_MACROS // local macro, see bottom of file
|
||||
@@ -322,31 +323,31 @@ namespace boost {
|
||||
|
||||
{
|
||||
// Graph requirements
|
||||
function_requires< VertexListGraphConcept<Graph1> >();
|
||||
function_requires< EdgeListGraphConcept<Graph1> >();
|
||||
function_requires< VertexListGraphConcept<Graph2> >();
|
||||
function_requires< BidirectionalGraphConcept<Graph2> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph1> ));
|
||||
BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph1> ));
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph2> ));
|
||||
BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph2> ));
|
||||
|
||||
typedef typename graph_traits<Graph1>::vertex_descriptor vertex1_t;
|
||||
typedef typename graph_traits<Graph2>::vertex_descriptor vertex2_t;
|
||||
typedef typename graph_traits<Graph1>::vertices_size_type size_type;
|
||||
|
||||
// Vertex invariant requirement
|
||||
function_requires< AdaptableUnaryFunctionConcept<Invariant1,
|
||||
size_type, vertex1_t> >();
|
||||
function_requires< AdaptableUnaryFunctionConcept<Invariant2,
|
||||
size_type, vertex2_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( AdaptableUnaryFunctionConcept<Invariant1,
|
||||
size_type, vertex1_t> ));
|
||||
BOOST_CONCEPT_ASSERT(( AdaptableUnaryFunctionConcept<Invariant2,
|
||||
size_type, vertex2_t> ));
|
||||
|
||||
// Property map requirements
|
||||
function_requires< ReadWritePropertyMapConcept<IsoMapping, vertex1_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<IsoMapping, vertex1_t> ));
|
||||
typedef typename property_traits<IsoMapping>::value_type IsoMappingValue;
|
||||
BOOST_STATIC_ASSERT((is_same<IsoMappingValue, vertex2_t>::value));
|
||||
|
||||
function_requires< ReadablePropertyMapConcept<IndexMap1, vertex1_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<IndexMap1, vertex1_t> ));
|
||||
typedef typename property_traits<IndexMap1>::value_type IndexMap1Value;
|
||||
BOOST_STATIC_ASSERT((is_convertible<IndexMap1Value, size_type>::value));
|
||||
|
||||
function_requires< ReadablePropertyMapConcept<IndexMap2, vertex2_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<IndexMap2, vertex2_t> ));
|
||||
typedef typename property_traits<IndexMap2>::value_type IndexMap2Value;
|
||||
BOOST_STATIC_ASSERT((is_convertible<IndexMap2Value, size_type>::value));
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <boost/graph/dijkstra_shortest_paths.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -44,8 +45,8 @@ namespace boost {
|
||||
{
|
||||
typedef graph_traits<VertexAndEdgeListGraph> Traits1;
|
||||
typedef typename property_traits<Weight>::value_type DT;
|
||||
function_requires< BasicMatrixConcept<DistanceMatrix,
|
||||
typename Traits1::vertices_size_type, DT> >();
|
||||
BOOST_CONCEPT_ASSERT(( BasicMatrixConcept<DistanceMatrix,
|
||||
typename Traits1::vertices_size_type, DT> ));
|
||||
|
||||
typedef typename Traits1::directed_category DirCat;
|
||||
bool is_undirected = is_same<DirCat, undirected_tag>::value;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <boost/graph/named_function_params.hpp>
|
||||
#include <boost/pending/disjoint_sets.hpp>
|
||||
#include <boost/pending/indirect_cmp.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
@@ -51,18 +52,18 @@ namespace boost {
|
||||
if (num_vertices(G) == 0) return; // Nothing to do in this case
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::edge_descriptor Edge;
|
||||
function_requires<VertexListGraphConcept<Graph> >();
|
||||
function_requires<EdgeListGraphConcept<Graph> >();
|
||||
function_requires<OutputIteratorConcept<OutputIterator, Edge> >();
|
||||
function_requires<ReadWritePropertyMapConcept<Rank, Vertex> >();
|
||||
function_requires<ReadWritePropertyMapConcept<Parent, Vertex> >();
|
||||
function_requires<ReadablePropertyMapConcept<Weight, Edge> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( OutputIteratorConcept<OutputIterator, Edge> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<Rank, Vertex> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<Parent, Vertex> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<Weight, Edge> ));
|
||||
typedef typename property_traits<Weight>::value_type W_value;
|
||||
typedef typename property_traits<Rank>::value_type R_value;
|
||||
typedef typename property_traits<Parent>::value_type P_value;
|
||||
function_requires<ComparableConcept<W_value> >();
|
||||
function_requires<ConvertibleConcept<P_value, Vertex> >();
|
||||
function_requires<IntegerConcept<R_value> >();
|
||||
BOOST_CONCEPT_ASSERT(( ComparableConcept<W_value> ));
|
||||
BOOST_CONCEPT_ASSERT(( ConvertibleConcept<P_value, Vertex> ));
|
||||
BOOST_CONCEPT_ASSERT(( IntegerConcept<R_value> ));
|
||||
|
||||
disjoint_sets<Rank, Parent> dset(rank, parent);
|
||||
|
||||
|
||||
@@ -24,13 +24,14 @@
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/graph/visitors.hpp>
|
||||
#include <boost/graph/named_function_params.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class Visitor, class Graph>
|
||||
struct NeighborBFSVisitorConcept {
|
||||
void constraints() {
|
||||
function_requires< CopyConstructibleConcept<Visitor> >();
|
||||
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> ));
|
||||
vis.initialize_vertex(u, g);
|
||||
vis.discover_vertex(u, g);
|
||||
vis.examine_vertex(u, g);
|
||||
@@ -133,13 +134,13 @@ namespace boost {
|
||||
Buffer& Q, BFSVisitor vis, ColorMap color)
|
||||
|
||||
{
|
||||
function_requires< BidirectionalGraphConcept<BidirectionalGraph> >();
|
||||
BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<BidirectionalGraph> ));
|
||||
typedef graph_traits<BidirectionalGraph> GTraits;
|
||||
typedef typename GTraits::vertex_descriptor Vertex;
|
||||
typedef typename GTraits::edge_descriptor Edge;
|
||||
function_requires<
|
||||
NeighborBFSVisitorConcept<BFSVisitor, BidirectionalGraph> >();
|
||||
function_requires< ReadWritePropertyMapConcept<ColorMap, Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
NeighborBFSVisitorConcept<BFSVisitor, BidirectionalGraph> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<ColorMap, Vertex> ));
|
||||
typedef typename property_traits<ColorMap>::value_type ColorValue;
|
||||
typedef color_traits<ColorValue> Color;
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ namespace boost {
|
||||
BOOST_DEF_PROPERTY(vertex, lowpoint);
|
||||
BOOST_DEF_PROPERTY(vertex, potential);
|
||||
BOOST_DEF_PROPERTY(vertex, update);
|
||||
BOOST_DEF_PROPERTY(vertex, underlying);
|
||||
BOOST_DEF_PROPERTY(edge, reverse);
|
||||
BOOST_DEF_PROPERTY(edge, capacity);
|
||||
BOOST_DEF_PROPERTY(edge, flow);
|
||||
@@ -123,6 +124,7 @@ namespace boost {
|
||||
BOOST_DEF_PROPERTY(edge, discover_time);
|
||||
BOOST_DEF_PROPERTY(edge, update);
|
||||
BOOST_DEF_PROPERTY(edge, finished);
|
||||
BOOST_DEF_PROPERTY(edge, underlying);
|
||||
BOOST_DEF_PROPERTY(graph, visitor);
|
||||
|
||||
// These tags are used for property bundles
|
||||
|
||||
@@ -27,17 +27,32 @@ struct reverse_graph_tag { };
|
||||
template <typename EdgeDesc>
|
||||
class reverse_graph_edge_descriptor {
|
||||
public:
|
||||
EdgeDesc underlying_desc;
|
||||
EdgeDesc underlying_descx; // Odd name is because this needs to be public but shouldn't be exposed to users anymore
|
||||
|
||||
private:
|
||||
typedef EdgeDesc base_descriptor_type;
|
||||
|
||||
public:
|
||||
explicit reverse_graph_edge_descriptor(const EdgeDesc& underlying_desc = EdgeDesc())
|
||||
: underlying_desc(underlying_desc) {}
|
||||
explicit reverse_graph_edge_descriptor(const EdgeDesc& underlying_descx = EdgeDesc())
|
||||
: underlying_descx(underlying_descx) {}
|
||||
|
||||
friend bool operator==(const reverse_graph_edge_descriptor& a, const reverse_graph_edge_descriptor& b) {
|
||||
return a.underlying_desc == b.underlying_desc;
|
||||
return a.underlying_descx == b.underlying_descx;
|
||||
}
|
||||
friend bool operator!=(const reverse_graph_edge_descriptor& a, const reverse_graph_edge_descriptor& b) {
|
||||
return a.underlying_desc != b.underlying_desc;
|
||||
return a.underlying_descx != b.underlying_descx;
|
||||
}
|
||||
friend bool operator<(const reverse_graph_edge_descriptor& a, const reverse_graph_edge_descriptor& b) {
|
||||
return a.underlying_descx < b.underlying_descx;
|
||||
}
|
||||
friend bool operator>(const reverse_graph_edge_descriptor& a, const reverse_graph_edge_descriptor& b) {
|
||||
return a.underlying_descx > b.underlying_descx;
|
||||
}
|
||||
friend bool operator<=(const reverse_graph_edge_descriptor& a, const reverse_graph_edge_descriptor& b) {
|
||||
return a.underlying_descx <= b.underlying_descx;
|
||||
}
|
||||
friend bool operator>=(const reverse_graph_edge_descriptor& a, const reverse_graph_edge_descriptor& b) {
|
||||
return a.underlying_descx >= b.underlying_descx;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -58,6 +73,18 @@ struct reverse_graph_tag { };
|
||||
make_transform_iterator(ip.second, reverse_graph_edge_descriptor_maker<EdgeDesc>()));
|
||||
}
|
||||
|
||||
// Get the underlying descriptor from a vertex or edge descriptor
|
||||
template <typename Desc>
|
||||
struct get_underlying_descriptor_from_reverse_descriptor {
|
||||
typedef Desc type;
|
||||
static Desc convert(const Desc& d) {return d;}
|
||||
};
|
||||
template <typename Desc>
|
||||
struct get_underlying_descriptor_from_reverse_descriptor<reverse_graph_edge_descriptor<Desc> > {
|
||||
typedef Desc type;
|
||||
static Desc convert(const reverse_graph_edge_descriptor<Desc>& d) {return d.underlying_descx;}
|
||||
};
|
||||
|
||||
template <bool isEdgeList> struct choose_rev_edge_iter { };
|
||||
template <> struct choose_rev_edge_iter<true> {
|
||||
template <class G> struct bind_ {
|
||||
@@ -97,8 +124,7 @@ class reverse_graph {
|
||||
typedef transform_iterator<detail::reverse_graph_edge_descriptor_maker<typename Traits::edge_descriptor>, typename Traits::out_edge_iterator> in_edge_iterator;
|
||||
|
||||
// AdjacencyGraph requirements
|
||||
typedef typename adjacency_iterator_generator<Self,
|
||||
vertex_descriptor, out_edge_iterator>::type adjacency_iterator;
|
||||
typedef typename adjacency_iterator_generator<Self, vertex_descriptor, out_edge_iterator>::type adjacency_iterator;
|
||||
|
||||
// VertexListGraph requirements
|
||||
typedef typename Traits::vertex_iterator vertex_iterator;
|
||||
@@ -117,14 +143,20 @@ class reverse_graph {
|
||||
#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES
|
||||
// Bundled properties support
|
||||
template<typename Descriptor>
|
||||
typename graph::detail::bundled_result<BidirectionalGraph, Descriptor>::type&
|
||||
typename graph::detail::bundled_result<
|
||||
BidirectionalGraph,
|
||||
typename detail::get_underlying_descriptor_from_reverse_descriptor<Descriptor>::type
|
||||
>::type&
|
||||
operator[](Descriptor x)
|
||||
{ return m_g[x]; }
|
||||
{ return m_g[detail::get_underlying_descriptor_from_reverse_descriptor<Descriptor>::convert(x)]; }
|
||||
|
||||
template<typename Descriptor>
|
||||
typename graph::detail::bundled_result<BidirectionalGraph, Descriptor>::type const&
|
||||
typename graph::detail::bundled_result<
|
||||
BidirectionalGraph,
|
||||
typename detail::get_underlying_descriptor_from_reverse_descriptor<Descriptor>::type
|
||||
>::type const&
|
||||
operator[](Descriptor x) const
|
||||
{ return m_g[x]; }
|
||||
{ return m_g[detail::get_underlying_descriptor_from_reverse_descriptor<Descriptor>::convert(x)]; }
|
||||
#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES
|
||||
|
||||
static vertex_descriptor null_vertex()
|
||||
@@ -236,13 +268,15 @@ vertex(const typename graph_traits<BidirectionalGraph>::vertices_size_type v,
|
||||
}
|
||||
|
||||
template <class BidirectionalGraph, class GRef>
|
||||
inline std::pair<typename graph_traits<BidirectionalGraph>::edge_descriptor,
|
||||
bool>
|
||||
inline std::pair< typename graph_traits<reverse_graph<BidirectionalGraph,GRef> >::edge_descriptor,
|
||||
bool>
|
||||
edge(const typename graph_traits<BidirectionalGraph>::vertex_descriptor u,
|
||||
const typename graph_traits<BidirectionalGraph>::vertex_descriptor v,
|
||||
const reverse_graph<BidirectionalGraph,GRef>& g)
|
||||
{
|
||||
return edge(v, u, g.m_g);
|
||||
typedef typename graph_traits<BidirectionalGraph>::edge_descriptor underlying_edge_descriptor;
|
||||
std::pair<underlying_edge_descriptor, bool> e = edge(v, u, g.m_g);
|
||||
return std::make_pair(detail::reverse_graph_edge_descriptor<underlying_edge_descriptor>(e.first), e.second);
|
||||
}
|
||||
|
||||
template <class BidirectionalGraph, class GRef>
|
||||
@@ -280,14 +314,14 @@ template <class Edge, class BidirectionalGraph, class GRef>
|
||||
inline typename graph_traits<BidirectionalGraph>::vertex_descriptor
|
||||
source(const detail::reverse_graph_edge_descriptor<Edge>& e, const reverse_graph<BidirectionalGraph,GRef>& g)
|
||||
{
|
||||
return target(e.underlying_desc, g.m_g);
|
||||
return target(e.underlying_descx, g.m_g);
|
||||
}
|
||||
|
||||
template <class Edge, class BidirectionalGraph, class GRef>
|
||||
inline typename graph_traits<BidirectionalGraph>::vertex_descriptor
|
||||
target(const detail::reverse_graph_edge_descriptor<Edge>& e, const reverse_graph<BidirectionalGraph,GRef>& g)
|
||||
{
|
||||
return source(e.underlying_desc, g.m_g);
|
||||
return source(e.underlying_descx, g.m_g);
|
||||
}
|
||||
|
||||
|
||||
@@ -309,18 +343,18 @@ namespace detail {
|
||||
friend reference
|
||||
get(const reverse_graph_edge_property_map& m,
|
||||
const key_type& e) {
|
||||
return get(m.underlying_pm, e.underlying_desc);
|
||||
return get(m.underlying_pm, e.underlying_descx);
|
||||
}
|
||||
|
||||
friend void
|
||||
put(const reverse_graph_edge_property_map& m,
|
||||
const key_type& e,
|
||||
const value_type& v) {
|
||||
put(m.underlying_pm, e.underlying_desc, v);
|
||||
put(m.underlying_pm, e.underlying_descx, v);
|
||||
}
|
||||
|
||||
reference operator[](const key_type& k) {
|
||||
return (this->underlying_pm)[k.underlying_desc];
|
||||
reference operator[](const key_type& k) const {
|
||||
return (this->underlying_pm)[k.underlying_descx];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -388,6 +422,62 @@ put(Property p, reverse_graph<BidirectionalGraph,GRef>& g, const Key& k,
|
||||
put(get(p, g), k, val);
|
||||
}
|
||||
|
||||
// Get the underlying descriptor from a reverse_graph's wrapped edge descriptor
|
||||
|
||||
namespace detail {
|
||||
template <class E>
|
||||
struct underlying_edge_desc_map_type {
|
||||
E operator[](const reverse_graph_edge_descriptor<E>& k) const {
|
||||
return k.underlying_descx;
|
||||
}
|
||||
};
|
||||
|
||||
template <class E>
|
||||
E
|
||||
get(underlying_edge_desc_map_type<E> m,
|
||||
const reverse_graph_edge_descriptor<E>& k)
|
||||
{
|
||||
return m[k];
|
||||
}
|
||||
};
|
||||
|
||||
template <class E>
|
||||
struct property_traits<detail::underlying_edge_desc_map_type<E> > {
|
||||
typedef detail::reverse_graph_edge_descriptor<E> key_type;
|
||||
typedef E value_type;
|
||||
typedef const E& reference;
|
||||
typedef readable_property_map_tag category;
|
||||
};
|
||||
|
||||
template <class Graph, class GRef>
|
||||
struct property_map<reverse_graph<Graph, GRef>, edge_underlying_t> {
|
||||
private:
|
||||
typedef typename graph_traits<Graph>::edge_descriptor ed;
|
||||
|
||||
public:
|
||||
typedef detail::underlying_edge_desc_map_type<ed> type;
|
||||
typedef detail::underlying_edge_desc_map_type<ed> const_type;
|
||||
};
|
||||
|
||||
template <class Graph, class GRef>
|
||||
detail::underlying_edge_desc_map_type<typename graph_traits<Graph>::edge_descriptor>
|
||||
get(edge_underlying_t,
|
||||
const reverse_graph<Graph,GRef>& g)
|
||||
{
|
||||
return detail::underlying_edge_desc_map_type<typename graph_traits<Graph>::edge_descriptor>();
|
||||
}
|
||||
|
||||
template <class Graph, class GRef>
|
||||
typename graph_traits<Graph>::edge_descriptor
|
||||
get(edge_underlying_t,
|
||||
const reverse_graph<Graph,GRef>& g,
|
||||
const typename graph_traits<reverse_graph<Graph, GRef> >::edge_descriptor& k)
|
||||
{
|
||||
return k.underlying_descx;
|
||||
}
|
||||
|
||||
// Access to wrapped graph's graph properties
|
||||
|
||||
template<typename BidirectionalGraph, typename GRef, typename Tag,
|
||||
typename Value>
|
||||
inline void
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <boost/type_traits/conversion_traits.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/graph/overloading.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -93,11 +94,11 @@ namespace boost {
|
||||
const bgl_named_params<P, T, R>& params)
|
||||
{
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
function_requires< ReadWritePropertyMapConcept<ComponentMap, Vertex> >();
|
||||
function_requires< ReadWritePropertyMapConcept<RootMap, Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<ComponentMap, Vertex> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<RootMap, Vertex> ));
|
||||
typedef typename property_traits<RootMap>::value_type RootV;
|
||||
function_requires< ConvertibleConcept<RootV, Vertex> >();
|
||||
function_requires< ReadWritePropertyMapConcept<DiscoverTime, Vertex> >();
|
||||
BOOST_CONCEPT_ASSERT(( ConvertibleConcept<RootV, Vertex> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<DiscoverTime, Vertex> ));
|
||||
|
||||
typename property_traits<ComponentMap>::value_type total = 0;
|
||||
|
||||
@@ -282,7 +283,7 @@ namespace boost {
|
||||
kosaraju_strong_components(Graph& G, ComponentsMap c,
|
||||
FinishTime finish_time, ColorMap color)
|
||||
{
|
||||
function_requires< MutableGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( MutableGraphConcept<Graph> ));
|
||||
// ...
|
||||
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
#include <boost/concept/detail/concept_def.hpp>
|
||||
namespace boost {
|
||||
@@ -156,8 +157,8 @@ namespace detail
|
||||
const Path& p,
|
||||
const ClosedMatrix& m)
|
||||
{
|
||||
function_requires< IncidenceGraphConcept<Graph> >();
|
||||
function_requires< VertexIndexGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( VertexIndexGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
|
||||
// get the vertices in question
|
||||
@@ -181,7 +182,7 @@ namespace detail
|
||||
inline bool
|
||||
can_wrap_path(const Graph& g, const Path& p)
|
||||
{
|
||||
function_requires< IncidenceGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::out_edge_iterator OutIterator;
|
||||
|
||||
@@ -209,7 +210,7 @@ namespace detail
|
||||
Path& p,
|
||||
ClosedMatrix& closed)
|
||||
{
|
||||
function_requires< IncidenceGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<Graph>::edge_descriptor Edge;
|
||||
typedef typename graph_traits<Graph>::out_edge_iterator OutIterator;
|
||||
@@ -238,7 +239,7 @@ namespace detail
|
||||
inline bool
|
||||
exhaust_paths(const Graph& g, Path& p, ClosedMatrix& closed)
|
||||
{
|
||||
function_requires< GraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
|
||||
// if there's more than one vertex in the path, this closes
|
||||
@@ -272,10 +273,10 @@ namespace detail
|
||||
std::size_t minlen,
|
||||
std::size_t maxlen)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef std::vector<Vertex> Path;
|
||||
function_requires< CycleVisitorConcept<Visitor,Path,Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( CycleVisitorConcept<Visitor,Path,Graph> ));
|
||||
typedef std::vector<Vertex> VertexList;
|
||||
typedef std::vector<VertexList> ClosedMatrix;
|
||||
|
||||
@@ -320,7 +321,7 @@ tiernan_all_cycles(const Graph& g,
|
||||
std::size_t minlen,
|
||||
std::size_t maxlen)
|
||||
{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
|
||||
|
||||
VertexIterator i, end;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <boost/graph/topological_sort.hpp>
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/graph/named_function_params.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -76,12 +77,12 @@ namespace boost
|
||||
typedef typename graph_traits <
|
||||
Graph >::adjacency_iterator adjacency_iterator;
|
||||
|
||||
function_requires < VertexListGraphConcept < Graph > >();
|
||||
function_requires < AdjacencyGraphConcept < Graph > >();
|
||||
function_requires < VertexMutableGraphConcept < GraphTC > >();
|
||||
function_requires < EdgeMutableGraphConcept < GraphTC > >();
|
||||
function_requires < ReadablePropertyMapConcept < VertexIndexMap,
|
||||
vertex > >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept < Graph > ));
|
||||
BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept < Graph > ));
|
||||
BOOST_CONCEPT_ASSERT(( VertexMutableGraphConcept < GraphTC > ));
|
||||
BOOST_CONCEPT_ASSERT(( EdgeMutableGraphConcept < GraphTC > ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept < VertexIndexMap,
|
||||
vertex > ));
|
||||
|
||||
typedef size_type cg_vertex;
|
||||
std::vector < cg_vertex > component_number_vec(num_vertices(g));
|
||||
@@ -302,8 +303,8 @@ namespace boost
|
||||
typedef typename graph_traits < G >::vertex_descriptor vertex;
|
||||
typedef typename graph_traits < G >::vertex_iterator vertex_iterator;
|
||||
|
||||
function_requires < AdjacencyMatrixConcept < G > >();
|
||||
function_requires < EdgeMutableGraphConcept < G > >();
|
||||
BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept < G > ));
|
||||
BOOST_CONCEPT_ASSERT(( EdgeMutableGraphConcept < G > ));
|
||||
|
||||
// Matrix form:
|
||||
// for k
|
||||
@@ -328,8 +329,8 @@ namespace boost
|
||||
typedef typename graph_traits < G >::vertex_descriptor vertex;
|
||||
typedef typename graph_traits < G >::vertex_iterator vertex_iterator;
|
||||
|
||||
function_requires < AdjacencyMatrixConcept < G > >();
|
||||
function_requires < EdgeMutableGraphConcept < G > >();
|
||||
BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept < G > ));
|
||||
BOOST_CONCEPT_ASSERT(( EdgeMutableGraphConcept < G > ));
|
||||
|
||||
// Make sure second loop will work
|
||||
if (num_vertices(g) == 0)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <boost/graph/depth_first_search.hpp>
|
||||
#include <vector>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -32,16 +33,16 @@ namespace boost {
|
||||
VertexColorMap vertex_color,
|
||||
EdgeColorMap edge_color)
|
||||
{
|
||||
function_requires<IncidenceGraphConcept<IncidenceGraph> >();
|
||||
function_requires<DFSVisitorConcept<DFSVisitor, IncidenceGraph> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<IncidenceGraph> ));
|
||||
BOOST_CONCEPT_ASSERT(( DFSVisitorConcept<DFSVisitor, IncidenceGraph> ));
|
||||
typedef typename graph_traits<IncidenceGraph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<IncidenceGraph>::edge_descriptor Edge;
|
||||
function_requires<ReadWritePropertyMapConcept<VertexColorMap,Vertex> >();
|
||||
function_requires<ReadWritePropertyMapConcept<EdgeColorMap,Edge> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<VertexColorMap,Vertex> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<EdgeColorMap,Edge> ));
|
||||
typedef typename property_traits<VertexColorMap>::value_type ColorValue;
|
||||
typedef typename property_traits<EdgeColorMap>::value_type EColorValue;
|
||||
function_requires< ColorValueConcept<ColorValue> >();
|
||||
function_requires< ColorValueConcept<EColorValue> >();
|
||||
BOOST_CONCEPT_ASSERT(( ColorValueConcept<ColorValue> ));
|
||||
BOOST_CONCEPT_ASSERT(( ColorValueConcept<EColorValue> ));
|
||||
typedef color_traits<ColorValue> Color;
|
||||
typedef color_traits<EColorValue> EColor;
|
||||
typedef typename graph_traits<IncidenceGraph>::out_edge_iterator Iter;
|
||||
@@ -94,16 +95,16 @@ namespace boost {
|
||||
VertexColorMap vertex_color,
|
||||
EdgeColorMap edge_color)
|
||||
{
|
||||
function_requires<IncidenceGraphConcept<IncidenceGraph> >();
|
||||
function_requires<DFSVisitorConcept<DFSVisitor, IncidenceGraph> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<IncidenceGraph> ));
|
||||
BOOST_CONCEPT_ASSERT(( DFSVisitorConcept<DFSVisitor, IncidenceGraph> ));
|
||||
typedef typename graph_traits<IncidenceGraph>::vertex_descriptor Vertex;
|
||||
typedef typename graph_traits<IncidenceGraph>::edge_descriptor Edge;
|
||||
function_requires<ReadWritePropertyMapConcept<VertexColorMap,Vertex> >();
|
||||
function_requires<ReadWritePropertyMapConcept<EdgeColorMap,Edge> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<VertexColorMap,Vertex> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<EdgeColorMap,Edge> ));
|
||||
typedef typename property_traits<VertexColorMap>::value_type ColorValue;
|
||||
typedef typename property_traits<EdgeColorMap>::value_type EColorValue;
|
||||
function_requires< ColorValueConcept<ColorValue> >();
|
||||
function_requires< ColorValueConcept<EColorValue> >();
|
||||
BOOST_CONCEPT_ASSERT(( ColorValueConcept<ColorValue> ));
|
||||
BOOST_CONCEPT_ASSERT(( ColorValueConcept<EColorValue> ));
|
||||
typedef color_traits<ColorValue> Color;
|
||||
typedef color_traits<EColorValue> EColor;
|
||||
typename graph_traits<IncidenceGraph>::out_edge_iterator ei, ei_end;
|
||||
@@ -134,8 +135,8 @@ namespace boost {
|
||||
VertexColorMap vertex_color, EdgeColorMap edge_color,
|
||||
Vertex start_vertex)
|
||||
{
|
||||
function_requires<DFSVisitorConcept<DFSVisitor, Graph> >();
|
||||
function_requires<EdgeListGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( DFSVisitorConcept<DFSVisitor, Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
|
||||
|
||||
typedef typename property_traits<VertexColorMap>::value_type ColorValue;
|
||||
typedef color_traits<ColorValue> Color;
|
||||
|
||||
Reference in New Issue
Block a user