Compare commits

...

7 Commits

Author SHA1 Message Date
Louis Dionne e63940fea1 [hawick] Support passing std::reference_wrapper to boost::hawick_circuits
Reported as ldionne/hawick_circuits#1.
2021-04-14 16:25:43 -04:00
Peter Dimov 0c9dbd7808 Merge branch 'master' into develop 2020-11-01 16:20:07 +02:00
Peter Dimov 83646b1913 Merge pull request #215 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74
2020-08-24 14:08:17 +03:00
Edward Diener 4149230e27 Corrected fix. 2020-04-08 19:08:47 -04:00
Edward Diener 7f77c3563b Include ctime and use std::time function. 2020-04-03 12:11:43 -04:00
Edward Diener 14c2bf17b4 Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. 2020-03-31 08:36:03 -04:00
jzmaddock ca17604dca Update readme with correct bug reporting locations, plus CI badges. 2020-02-09 19:48:38 +00:00
12 changed files with 84 additions and 15 deletions
+15 -4
View File
@@ -1,4 +1,4 @@
Boost Graph Library
Boost Graph Library [![Build Status](https://travis-ci.org/boostorg/graph.svg?branch=develop)](https://travis-ci.org/boostorg/graph)
===================
A generic interface for traversing graphs, using C++ templates.
@@ -7,9 +7,14 @@ The full documentation is available on [boost.org](http://www.boost.org/doc/libs
## Support, bugs and feature requests ##
Bugs and feature requests can be reported through the [Trac issue tracker](https://svn.boost.org/trac/boost/query?component=graph&desc=1&order=id)
(see [open issues](https://svn.boost.org/trac/boost/query?status=!closed&component=graph&desc=1&order=id) and
[closed issues](https://svn.boost.org/trac/boost/query?status=closed&component=graph&col=id&col=summary&col=status&col=owner&col=type&col=milestone&col=version&desc=1&order=id)). [Here](http://lists.boost.org/Archives/boost/2015/04/221780.php) is why Trac is still in use.
Bugs and feature requests can be reported through the [Github issue page](https://github.com/boostorg/graph/issues).
See also:
* [Current open issues](https://github.com/boostorg/graph/issues)
* [Closed issues](https://github.com/boostorg/graph/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aclosed)
* Old issues still open on [Trac](https://svn.boost.org/trac/boost/query?status=!closed&component=graph&desc=1&order=id)
* Closed issues on [Trac](https://svn.boost.org/trac/boost/query?status=closed&component=graph&col=id&col=summary&col=status&col=owner&col=type&col=milestone&col=version&desc=1&order=id)).
You can submit your changes through a [pull request](https://github.com/boostorg/graph/pulls). One of the maintainers will take a look (remember that it can take some time).
@@ -18,6 +23,12 @@ There is no mailing-list specific to Boost Graph, although you can use the gener
## Development ##
| | Master | Develop |
|------------------|----------|-------------|
| Travis | [![Build Status](https://travis-ci.org/boostorg/graph.svg?branch=master)](https://travis-ci.org/boostorg/graph) | [![Build Status](https://travis-ci.org/boostorg/graph.svg)](https://travis-ci.org/boostorg/graph) |
| Appveyor | [![Build status](https://ci.appveyor.com/api/projects/status/78gegk21tc1g3v8d/branch/master?svg=true)](https://ci.appveyor.com/project/jzmaddock/graph/branch/master) | [![Build status](https://ci.appveyor.com/api/projects/status/78gegk21tc1g3v8d/branch/develop?svg=true)](https://ci.appveyor.com/project/jzmaddock/graph/branch/develop) |
Clone the whole boost project, which includes the individual Boost projects as submodules ([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)):
git clone https://github.com/boostorg/boost
+4
View File
@@ -49,6 +49,10 @@ edges are not desired.</p>
<p>For example, if a circuit <code>u -&gt; v -&gt; w -&gt; u</code> exists in the graph, the
visitor will be called with a sequence consisting of <code>(u, v, w)</code>.</p>
Note that if <code>visitor</code> is a <code>std::reference_wrapper</code>,
it will be unwrapped before the <code>.cycle</code> method being called on it.
This allows passing a visitor that shouldn't be copied.
</blockquote>
<p><strong>IN:</strong> <code>VertexIndexMap const&amp; vim = get(vertex_index, graph)</code></p>
@@ -8,11 +8,11 @@
#ifndef BOOST_DEPRECATED_INCLUDE_EDMONDS_KARP_MAX_FLOW_HPP
#define BOOST_DEPRECATED_INCLUDE_EDMONDS_KARP_MAX_FLOW_HPP
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
#if defined(_MSC_VER) || defined(__BORLANDC__) && !defined(__clang__) || defined(__DMC__)
#pragma message( \
"Warning: This header is deprecated. Please use: boost/graph/edmonds_karp_max_flow.hpp")
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) \
|| defined(__IBMCPP__)
|| defined(__IBMCPP__) || defined(__BORLANDC__)
#warning \
"This header is deprecated. Please use: boost/graph/edmonds_karp_max_flow.hpp"
#endif
+1 -1
View File
@@ -38,7 +38,7 @@ namespace boost
// It is needed in order to allow us to write using boost::vertices as
// needed for ADL when using vector_as_graph below.
#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) \
&& !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
&& !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
#define BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
#endif
+15 -1
View File
@@ -21,6 +21,7 @@
#include <boost/tuple/tuple.hpp> // for boost::tie
#include <boost/type_traits/remove_reference.hpp>
#include <boost/utility/result_of.hpp>
#include <functional> // for std::reference_wrapper
#include <set>
#include <utility> // for std::pair
#include <vector>
@@ -89,6 +90,18 @@ namespace hawick_circuits_detail
return std::find(boost::begin(c), boost::end(c), v) != boost::end(c);
}
template < typename T >
struct unwrap_reference_wrapper {
typedef T type;
};
#if __cplusplus >= 201103L
template < typename T >
struct unwrap_reference_wrapper<std::reference_wrapper<T> > {
typedef T& type;
};
#endif
/*!
* @internal
* Algorithm finding all the cycles starting from a given vertex.
@@ -301,8 +314,9 @@ namespace hawick_circuits_detail
typedef std::vector< Vertex > Stack;
typedef std::vector< std::vector< Vertex > > ClosedMatrix;
typedef typename unwrap_reference_wrapper<Visitor>::type VisitorNoRef;
typedef hawick_circuits_from< Graph, Visitor, VertexIndexMap, Stack,
typedef hawick_circuits_from< Graph, VisitorNoRef, VertexIndexMap, Stack,
ClosedMatrix, GetAdjacentVertices >
SubAlgorithm;
+2 -2
View File
@@ -38,7 +38,7 @@ typename graph_traits< Graph >::vertex_descriptor random_vertex(
{
if (num_vertices(g) > 1)
{
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
std::size_t n = std::random(num_vertices(g));
#else
uniform_int<> distrib(0, num_vertices(g) - 1);
@@ -59,7 +59,7 @@ typename graph_traits< Graph >::edge_descriptor random_edge(
{
if (num_edges(g) > 1)
{
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
typename graph_traits< Graph >::edges_size_type n
= std::random(num_edges(g));
#else
+2 -1
View File
@@ -10,6 +10,7 @@
#include <iostream>
#include <map>
#include <vector>
#include <ctime>
#include <boost/config.hpp>
#ifdef BOOST_MSVC
@@ -80,7 +81,7 @@ int main(int argc, char* argv[])
int vertices_to_create = 10;
int edges_to_create = 500;
std::size_t random_seed = time(0);
std::size_t random_seed = std::time(0);
if (argc > 1)
{
+2 -1
View File
@@ -10,6 +10,7 @@
#include <fstream>
#include <iostream>
#include <set>
#include <ctime>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
@@ -224,7 +225,7 @@ template < unsigned int Dims > void do_test(minstd_rand& generator)
int main(int argc, char* argv[])
{
std::size_t random_seed = time(0);
std::size_t random_seed = std::time(0);
if (argc > 1)
{
+36
View File
@@ -6,6 +6,8 @@
#include "cycle_test.hpp"
#include <boost/graph/hawick_circuits.hpp>
#include <cstddef>
#include <functional>
#include <iostream>
struct call_hawick_circuits
@@ -26,6 +28,20 @@ struct call_hawick_unique_circuits
}
};
struct not_copyable
{
not_copyable() { }
template < typename Path, typename Graph >
void cycle(Path const&, Graph const&)
{
}
private:
not_copyable(not_copyable const&);
};
int main()
{
std::cout << "---------hawick_circuits---------\n";
@@ -33,4 +49,24 @@ int main()
std::cout << "\n\n---------hawick_unique_circuits---------\n";
cycle_test(call_hawick_unique_circuits());
// Make sure we can pass a reference_wrapper to the algorithm.
#if __cplusplus >= 201103L
{
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> Graph;
typedef std::pair<std::size_t, std::size_t> Pair;
Pair edges[3] = {
Pair(0, 1), // a->b
Pair(1, 2), // b->c
Pair(2, 0), // c->a
};
Graph G(3);
for (int i = 0; i < 3; ++i)
add_edge(edges[i].first, edges[i].second, G);
not_copyable visitor;
boost::hawick_circuits(G, std::ref(visitor));
}
#endif // >= C++11
}
+2 -1
View File
@@ -10,6 +10,7 @@
#include <iostream>
#include <map>
#include <set>
#include <ctime>
#include <boost/foreach.hpp>
#include <boost/graph/adjacency_list.hpp>
@@ -127,7 +128,7 @@ template < typename Graph > void test_graph(const Graph& graph)
int main(int argc, char* argv[])
{
std::size_t vertices_to_generate = 100, edges_to_generate = 50,
random_seed = time(0);
random_seed = std::time(0);
// Parse command-line arguments
+2 -1
View File
@@ -12,6 +12,7 @@
#include <fstream>
#include <sstream>
#include <vector>
#include <ctime>
#include <boost/lexical_cast.hpp>
#include <boost/random.hpp>
@@ -311,7 +312,7 @@ int main(int argc, char* argv[])
{
int vertices_to_create = 10;
int max_edges_per_vertex = 2;
std::size_t random_seed = time(0);
std::size_t random_seed = std::time(0);
if (argc > 1)
{
+1 -1
View File
@@ -90,7 +90,7 @@ void testScalability(unsigned numpts)
typedef set< simple_point< double >, cmpPnt< double > > PointSet;
typedef vector< Vertex > Container;
boost::mt19937 rng(time(0));
boost::mt19937 rng(std::time(0));
uniform_real<> range(0.01, (numpts * 2));
variate_generator< boost::mt19937&, uniform_real<> > pnt_gen(rng, range);