Go to the documentation of this file. 1 #ifndef GRAPH_ANALYSIS_BOOST_GRAPH_ARC_ITERATOR_HPP
2 #define GRAPH_ANALYSIS_BOOST_GRAPH_ARC_ITERATOR_HPP
4 #include "../EdgeIterator.hpp"
5 #include "../Vertex.hpp"
6 #include <boost/graph/adjacency_list.hpp>
9 namespace boost_graph {
14 typedef typename boost::graph_traits< typename T::graph_t >::edge_iterator EdgeIteratorImpl;
15 typedef typename boost::graph_traits< typename T::graph_t >::edge_descriptor EdgeDescriptor;
21 boost::tie(mStart, mEnd) = boost::edges(mGraph.raw());
27 while( mCurrent != mEnd)
29 EdgeDescriptor edgeDescriptor = *mCurrent;
30 Edge::Ptr edge = mGraph.raw()[edgeDescriptor];
53 typedef typename boost::graph_traits< typename T::graph_t >::out_edge_iterator EdgeIteratorImpl;
54 typedef typename boost::graph_traits< typename T::graph_t >::edge_descriptor EdgeDescriptor;
55 typedef typename boost::graph_traits< typename T::graph_t >::vertex_descriptor VertexDescriptor;
62 typename T::VertexMap::const_iterator cit = mGraph.mVertexMap.find(
id);
63 if(cit == mGraph.mVertexMap.end())
65 throw std::invalid_argument(
"graph_analysis::boost_graph::OutArcIterator: '" + vertex->toString() +
"' is not part of this graph");
67 VertexDescriptor vertexDescriptor = cit->second;
68 boost::tie(mStart, mEnd) = boost::out_edges(vertexDescriptor, mGraph.raw());
74 while( mCurrent != mEnd)
76 EdgeDescriptor edgeDescriptor = *mCurrent;
77 Edge::Ptr edge = mGraph.raw()[edgeDescriptor];
100 typedef typename boost::graph_traits< typename T::graph_t >::in_edge_iterator EdgeIteratorImpl;
101 typedef typename boost::graph_traits< typename T::graph_t >::edge_descriptor EdgeDescriptor;
102 typedef typename boost::graph_traits< typename T::graph_t >::vertex_descriptor VertexDescriptor;
109 typename T::VertexMap::const_iterator cit = mGraph.mVertexMap.find(
id);
110 if(cit == mGraph.mVertexMap.end())
112 throw std::invalid_argument(
"graph_analysis::boost_graph::InArcIterator: '" + vertex->toString() +
"' is not part of this graph");
114 VertexDescriptor vertexDescriptor = cit->second;
115 boost::tie(mStart, mEnd) = boost::in_edges(vertexDescriptor, mGraph.raw());
121 while( mCurrent != mEnd)
123 EdgeDescriptor edgeDescriptor = *mCurrent;
124 Edge::Ptr edge = mGraph.raw()[edgeDescriptor];
180 #endif // GRAPH_ANALYSIS_BOOST_GRAPH_ARC_ITERATOR_HPP
bool next()
Test if there is a next item and if it is then updates the current to next.
Definition: ArcIterator.hpp:25
bool next()
Test if there is a next item and if it is then updates the current to next.
Definition: ArcIterator.hpp:119
bool skip(const Edge::Ptr &edge) const
Check if edge should be skipped.
Definition: EdgeIterator.cpp:5
OutArcIterator(const T &graph, Vertex::Ptr vertex)
Definition: ArcIterator.hpp:58
Definition: ArcIterator.hpp:51
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
InArcIterator< T > mInArcIterator
Definition: ArcIterator.hpp:174
boost::graph_traits< BidirectionalGraph >::edge_iterator EdgeIteratorImpl
Definition: DirectedGraph.hpp:37
InArcIterator(const T &graph, Vertex::Ptr vertex)
Definition: ArcIterator.hpp:105
Definition: ArcIterator.hpp:145
uint32_t GraphElementId
Definition: GraphElement.hpp:21
bool next()
Test if there is a next item and if it is then updates the current to next.
Definition: ArcIterator.hpp:154
shared_ptr< Vertex > Ptr
Definition: Vertex.hpp:22
EdgeIterator interface Allows to access all edges of a graph. Requires implementation to wrap the und...
Definition: EdgeIterator.hpp:14
Definition: ArcIterator.hpp:12
OutArcIterator< T > mOutArcIterator
Definition: ArcIterator.hpp:175
ArcIterator(const T &graph)
Definition: ArcIterator.hpp:18
InOutArcIterator(const T &graph, Vertex::Ptr vertex)
Definition: ArcIterator.hpp:148
void setNext(const Edge::Ptr &edge)
Set next edge Should be applied by class implementing next()
Definition: EdgeIterator.hpp:48
bool next()
Test if there is a next item and if it is then updates the current to next.
Definition: ArcIterator.hpp:72
Definition: ArcIterator.hpp:98
const T & mGraph
Definition: ArcIterator.hpp:173