1#ifndef UG_GRAPH_UNDIRECTED_BOOST_H
2#define UG_GRAPH_UNDIRECTED_BOOST_H
6#include <boost/iterator/counting_iterator.hpp>
12class UM_adjacency_iterator :
public iterator_facade<
13 UM_adjacency_iterator<T>,
14 typename ug::SparseMatrix<T>::const_row_iterator,
15 std::input_iterator_tag,
20 typedef typename M::const_row_iterator iter_t;
24 typedef intmax_t difference_type;
25 typedef size_t reference;
28 UM_adjacency_iterator() : _base(nullptr), _end(nullptr){}
29 UM_adjacency_iterator(UM_adjacency_iterator&& p) =
delete;
30 UM_adjacency_iterator(UM_adjacency_iterator
const& p)
31 : _base(
p._base?(
new iter_t(*
p._base)) : nullptr)
32 , _end(
p._end?(
new iter_t(*
p._end)) : nullptr){
36 _base =
new iter_t(*p);
37 _end =
new iter_t(*e);
40 ~UM_adjacency_iterator(){
46 T
const& value()
const {
48 return _base->value();
58 reference dereference()
const {
60 return _base->index();
62 bool operator==(
const UM_adjacency_iterator& other)
const {
65 return *_base == *other._base;
67 bool operator!=(
const UM_adjacency_iterator& other)
const {
70 return *_base != *other._base;
72 UM_adjacency_iterator operator=(
const UM_adjacency_iterator& other) {
74 _base =
new iter_t(*other._base);
79 _end =
new iter_t(*other._end);
89 while((*_base) != (*_end)){
90 if(
iszero(_base->value())){
97 bool equal(UM_adjacency_iterator
const& other)
const {
untested();
100 return *_base == *other._base;
117 friend class iterator_core_access;
122 UM_out_edge_iterator<T>,
123 typename ug::UndirectedMatrix<T>::adjacency_iterator,
125 std::input_iterator_tag,
126 typename ug::UndirectedMatrix<T>::edge,
130 typedef iterator_facade<
134 std::input_iterator_tag,
177 return ret.base.first - other.base.first;
222template <
class T>
struct graph_traits<
ug::UndirectedMatrix<T>>{
222template <
class T>
struct graph_traits<
ug::UndirectedMatrix<T>> {
…};
237std::pair<counting_iterator<size_t>, counting_iterator<size_t> >
vertices(
240 counting_iterator<size_t> b(0);
241 counting_iterator<size_t> e(M.
num_rows());
243 return std::make_pair(b,e);
237std::pair<counting_iterator<size_t>, counting_iterator<size_t> >
vertices( {
…}
265std::pair<UM_out_edge_iterator<T>, UM_out_edge_iterator<T> >
274 return std::make_pair(ei(v, b), ei(v, e));
278std::pair<typename ug::UndirectedMatrix<T>::adjacency_iterator,
287 return std::make_pair(b, e);
291int source(
typename T::edge
const& e, T
const&)
291int source(
typename T::edge
const& e, T
const&) {
…}
297int target(
typename T::edge
const& e, T
const&)
297int target(
typename T::edge
const& e, T
const&) {
…}
303struct property_map<
ug::UndirectedMatrix<T>, vertex_index_t>{
303struct property_map<
ug::UndirectedMatrix<T>, vertex_index_t> {
…};
309inline typename property_map<ug::UndirectedMatrix<T>, vertex_index_t>::const_type
322class degree_property_map<
ug::UndirectedMatrix<T> >
323:
public put_get_helper< typename graph_traits< ug::UndirectedMatrix<T> >::degree_size_type,
324 degree_property_map< ug::UndirectedMatrix<T> > >
328 typedef typename graph_traits< Graph >::vertex_descriptor
key_type;
329 typedef typename graph_traits< Graph >::degree_size_type
value_type;
322class degree_property_map<
ug::UndirectedMatrix<T> > {
…};
340degree_property_map< ug::UndirectedMatrix<T> >
343 return degree_property_map< ug::UndirectedMatrix<T> >(g);
Definition undirected_boost.h:128
ug::UndirectedMatrix< T >::edge reference
Definition undirected_boost.h:142
void increment()
Definition undirected_boost.h:188
friend class iterator_core_access
Definition undirected_boost.h:218
iterator_facade< UM_out_edge_iterator< T >, typename ug::UndirectedMatrix< T >::adjacency_iterator, std::input_iterator_tag, typename ug::UndirectedMatrix< T >::edge, std::intmax_t > base_class
Definition undirected_boost.h:137
~UM_out_edge_iterator()
Definition undirected_boost.h:155
UM_out_edge_iterator(UM_out_edge_iterator const &p)
Definition undirected_boost.h:151
int _v
Definition undirected_boost.h:216
UM_out_edge_iterator()
Definition undirected_boost.h:146
UM_out_edge_iterator operator++(int)
Definition undirected_boost.h:203
reference dereference() const
Definition undirected_boost.h:181
bool equal(UM_out_edge_iterator const &other) const
Definition undirected_boost.h:184
UM_out_edge_iterator(UM_out_edge_iterator &&p)=delete
intmax_t difference_type
Definition undirected_boost.h:141
UM_out_edge_iterator & operator=(UM_out_edge_iterator const &p)
Definition undirected_boost.h:157
ug::SparseMatrix< T > M
Definition undirected_boost.h:139
UM_out_edge_iterator & operator++()
Definition undirected_boost.h:199
ug::UndirectedMatrix< T >::edge edge_type
Definition undirected_boost.h:143
void decrement()
Definition undirected_boost.h:191
UM_out_edge_iterator(int v, value_type w)
Definition undirected_boost.h:148
value_type _base
Definition undirected_boost.h:217
bool operator!=(const UM_out_edge_iterator &other) const
Definition undirected_boost.h:211
ug::UndirectedMatrix< T >::adjacency_iterator value_type
Definition undirected_boost.h:140
UM_out_edge_iterator & operator=(UM_out_edge_iterator &&p)=delete
bool operator==(const UM_out_edge_iterator &other) const
Definition undirected_boost.h:208
graph_traits< Graph >::vertex_descriptor key_type
Definition undirected_boost.h:328
readable_property_map_tag category
Definition undirected_boost.h:331
degree_property_map(const Graph &g)
Definition undirected_boost.h:332
Graph const & m_g
Definition undirected_boost.h:336
graph_traits< Graph >::degree_size_type value_type
Definition undirected_boost.h:329
ug::UndirectedMatrix< T > Graph
Definition undirected_boost.h:327
value_type operator[](const key_type &v) const
Definition undirected_boost.h:333
value_type reference
Definition undirected_boost.h:330
Definition sparsematrix_boost.h:350
sparse matrix for big, variable sparse matrices.
Definition sparsematrix.h:99
Definition undirected.h:57
Definition undirected.h:50
int num_rows() const
Definition undirected.h:96
int degree(int v) const
Definition undirected.h:110
boost::geometry::concatenate_iterator< boost::SM_adjacency_iterator< value_type >, G_adj_it, int, int > adjacency_iterator
Definition undirected.h:73
adjacency_iterator begin_row(int row) const
Definition undirected.h:128
adjacency_iterator end_row(int row) const
Definition undirected.h:134
bool operator==(const MathVector< N, T > &v, const MathVector< N, T > &w)
Definition math_vector.h:523
bool operator!=(const MathVector< N, T > &v, const MathVector< N, T > &w)
Definition math_vector.h:552
#define untested()
Definition lua_table_handle.cpp:15
Definition boost_serialization_routines.h:49
std::pair< typename graph_traits< T >::adjacency_iterator, typename graph_traits< T >::adjacency_iterator > adjacent_vertices(size_t v, ug::BidirectionalMatrix< T > const &M)
Definition bidirectional_boost.h:108
std::pair< SM_out_edge_iterator< typename T::value_type >, SM_out_edge_iterator< typename T::value_type > > out_edges(size_t v, ug::BidirectionalMatrix< T > const &g)
Definition bidirectional_boost.h:136
int out_degree(int v, ug::BidirectionalMatrix< T > const &M)
Definition bidirectional_boost.h:76
int degree(int v, ug::BidirectionalMatrix< T > const &M)
Definition bidirectional_boost.h:88
int in_degree(int v, ug::BidirectionalMatrix< T > const &M)
Definition bidirectional_boost.h:82
std::pair< counting_iterator< size_t >, counting_iterator< size_t > > vertices(ug::BidirectionalMatrix< T > const &M)
Definition bidirectional_boost.h:60
int num_vertices(ug::BidirectionalMatrix< T > const &M)
Definition bidirectional_boost.h:70
SM_edge_weight_map< typename T::value_type, ug::BidirectionalMatrix< T > > get(edge_weight_t, ug::BidirectionalMatrix< T > const &g)
Definition bidirectional_boost.h:157
size_t target(SM_edge< typename T::value_type > const &e, ug::BidirectionalMatrix< T > const &m)
Definition bidirectional_boost.h:100
size_t source(SM_edge< typename T::value_type > const &e, ug::BidirectionalMatrix< T > const &)
Definition bidirectional_boost.h:94
degree_property_map< ug::UndirectedMatrix< T > > make_degree_map(const ug::UndirectedMatrix< T > &g)
Definition undirected_boost.h:341
bool iszero(__T __val)
Definition sparsematrix_impl.h:53
T value_type
Definition sparsematrix_interface.h:2
Definition sparsematrix_boost.h:309
disallow_parallel_edge_tag edge_parallel_category
Definition undirected_boost.h:227
undirected_tag directed_category
Definition undirected_boost.h:226
G::adjacency_iterator adjacency_iterator
Definition undirected_boost.h:231
ug::UndirectedMatrix< T > G
Definition undirected_boost.h:223
int vertex_descriptor
Definition undirected_boost.h:224
int degree_size_type
Definition undirected_boost.h:232
counting_iterator< size_t > vertex_iterator
Definition undirected_boost.h:229
int vertices_size_type
Definition undirected_boost.h:233
G::edge edge_descriptor
Definition undirected_boost.h:225
SM_traversal_tag traversal_category
Definition undirected_boost.h:228
UM_out_edge_iterator< T > out_edge_iterator
Definition undirected_boost.h:230
type const_type
Definition undirected_boost.h:305
sparse_matrix_index_map< T > type
Definition undirected_boost.h:304
function ProblemDisc new(problemDesc, dom)