12 #ifndef META_UNDIRECTED_GRAPH_H_
13 template <
class A,
class B>
16 #ifndef META_DIRECTED_GRAPH_H_
17 template <
class A,
class B>
22 class edge_iterator :
public std::iterator<std::forward_iterator_tag, Edge>
25 typedef typename graph<Node, Edge>::adjacency_list adj_list;
27 typedef typename std::
28 conditional<std::is_same<Iter, typename vec_t::const_iterator>::value,
29 const Edge, Edge>::type value_type;
30 typedef value_type& reference;
31 typedef value_type* pointer;
32 typedef std::forward_iterator_tag iterator_category;
33 typedef ptrdiff_t difference_type;
35 friend bool operator==(
const self_type& lhs,
const self_type& rhs)
37 return lhs.iter_ == rhs.iter_ && lhs.end_ == rhs.end_;
40 friend bool operator!=(
const self_type& lhs,
const self_type& rhs)
48 end_{iter == end_iter},
53 init(handle->num_edges());
59 end_{iter == end_iter},
64 init(handle->num_edges());
67 void init(uint64_t num_edges)
74 else if (iter_ != end_iter_)
76 al_iter_ = iter_->second.begin();
77 if (iter_->second.empty())
82 self_type operator++()
84 if (++al_iter_ == iter_->second.end())
86 while (++iter_ != end_iter_ && iter_->second.empty())
88 if (iter_ != end_iter_)
89 al_iter_ = iter_->second.begin();
96 if (is_undirected_ && !end_
98 < static_cast<uint64_t>(std::distance(beg_iter_, iter_)))
104 self_type operator++(
int)
106 self_type saved{*
this};
111 reference operator*()
113 return al_iter_->second;
118 return &al_iter_->second;
124 conditional<std::is_same<Iter, typename vec_t::const_iterator>::value,
125 typename adj_list::const_iterator,
126 typename adj_list::iterator>::type al_iter_;
Definition: edge_iterator.h:22
Definition: edge_iterator.h:18
Definition: edge_iterator.h:14