13 #ifndef ML_GRAPH_TO_BOOST_GRAPH_H
14 #define ML_GRAPH_TO_BOOST_GRAPH_H
20 #include <boost/version.hpp>
21 #include <boost/config.hpp>
22 #include <boost/operators.hpp>
23 #include <boost/graph/graph_traits.hpp>
24 #include <boost/graph/properties.hpp>
25 #include <boost/property_map/property_map.hpp>
38 class ml_vertex_iterator;
56 public virtual incidence_graph_tag,
58 public virtual vertex_list_graph_tag
123 ml_out_edge_iterator,
137 std::vector<ml::VesselEdge*>::iterator edgeIter,
138 std::vector<ml::VesselEdge*>::iterator edgeIterEnd)
146 !((*_edgeIter)->isPred(
_vertex)) )
166 return x._edgeIter == y._edgeIter; }
185 return e->predNode();
193 return e->succNode();
208 inline std::pair<boost::graph_traits<ml_graph_ptr>::out_edge_iterator,
213 return std::make_pair(
228 std::vector<ml::VesselEdge*>::iterator edgeIter =
vertex->edges()->begin();
229 std::vector<ml::VesselEdge*>::iterator edgeIterEnd =
vertex->edges()->end();
231 while (edgeIter != edgeIterEnd)
233 if ((*edgeIter)->isPred(
vertex))
246 inline std::pair<boost::graph_traits<ml_graph_ptr>::vertex_iterator,
250 return std::make_pair( g->beginNode(),
258 return static_cast<long> (g->numNodes());
266 return g->getNode(arrayIndex);
326 std::cout <<
"edge.getWeight() = " << edge->getWeight() << std::endl;
327 return edge->getWeight();
351 template<
class T,
class ValueType>
379 template <
class IteratorTraits,
class IDMap>
384 typedef typename property_traits<IDMap>::key_type
key_type;
392 ml_iterator_map(
typename IteratorTraits::iterator_type i = IteratorTraits::iterator_type(),
393 const IDMap&
id = IDMap())
395 typename IteratorTraits::iterator_type
m_iter;
403 template <
class IteratorTraits,
class IDMap>
404 typename IteratorTraits::value_type
406 typename property_traits<IDMap>::key_type key)
410 template <
class IteratorTraits,
class IDMap>
413 typename property_traits<IDMap>::key_type key,
414 const typename IteratorTraits::value_type& value)
420 template <
class IteratorTraits,
class IDMap>
421 typename IteratorTraits::value_type&
423 typename property_traits<IDMap>::key_type key)
value_type operator[](ml::VesselEdge *edge) const
ml::VesselEdge * key_type
boost::lvalue_property_map_tag category
This is a helper template to create an external property map for an std random access container.
property_traits< IDMap >::key_type key_type
ml_iterator_map(typename IteratorTraits::iterator_type i=IteratorTraits::iterator_type(), const IDMap &id=IDMap())
Constructor, takes an iterator to the beginning of a container, for example std::vector<>....
IteratorTraits::value_type value_type
IteratorTraits::iterator_type m_iter
lvalue_property_map_tag category
IteratorTraits::value_type & reference
Vertex id Maps each vertex to a unique id.
boost::readable_property_map_tag category
ml::VesselNode * key_type
unsigned int operator[](ml::VesselNode *vertex) const
ml_vertex_id_map(ml_graph_ptr g)
std::vector< ml::VesselEdge * >::iterator _edgeIter
std::vector< ml::VesselEdge * >::iterator _edgeIterEnd
ml_out_edge_iterator(ml::VesselNode *vertex, std::vector< ml::VesselEdge * >::iterator edgeIter, std::vector< ml::VesselEdge * >::iterator edgeIterEnd)
friend bool operator==(const self &x, const self &y)
ml::VesselEdge * operator*()
ml::Graph * ml_graph_ptr
typedef for use with graph_traits<>
Forward declaration for the boost::mutex class.
void put(const ml_iterator_map< IteratorTraits, IDMap > &i, typename property_traits< IDMap >::key_type key, const typename IteratorTraits::value_type &value)
IteratorTraits::value_type & at(const ml_iterator_map< IteratorTraits, IDMap > &i, typename property_traits< IDMap >::key_type key)
boost::graph_traits< ml_graph_ptr >::vertex_descriptor vertex(boost::graph_traits< ml_graph_ptr >::degree_size_type arrayIndex, const ml_graph_ptr g)
Returns the vertex at internal index.
ml_vertex_id_map get(vertex_index_t, ml_graph_ptr g)
get() function for vertex id property map vertex_index_t just necessary for overloading
std::pair< boost::graph_traits< ml_graph_ptr >::out_edge_iterator, boost::graph_traits< ml_graph_ptr >::out_edge_iterator > out_edges(boost::graph_traits< ml_graph_ptr >::vertex_descriptor vertex, const ml_graph_ptr)
Returns an iterator-range providing access to the out-edges (for directed graphs) or incident edges (...
boost::graph_traits< ml_graph_ptr >::vertex_descriptor source(graph_traits< ml_graph_ptr >::edge_descriptor e, const ml_graph_ptr)
Returns the vertex descriptor for u of the edge (u,v) represented by e.
boost::graph_traits< ml_graph_ptr >::degree_size_type out_degree(boost::graph_traits< ml_graph_ptr >::vertex_descriptor vertex, const ml_graph_ptr)
Returns the number of out-edges (for directed graphs) or the number of incident edges (for undirected...
std::pair< boost::graph_traits< ml_graph_ptr >::vertex_iterator, boost::graph_traits< ml_graph_ptr >::vertex_iterator > vertices(ml_graph_ptr g)
Returns an iterator-range providing access to all the vertices in the graph g.
boost::graph_traits< ml_graph_ptr >::vertex_descriptor target(graph_traits< ml_graph_ptr >::edge_descriptor e, const ml_graph_ptr)
Returns the vertex descriptor for v of the edge (u,v) represented by e.
boost::graph_traits< ml_graph_ptr >::vertices_size_type num_vertices(const ml_graph_ptr g)
Returns the number of vertices in the graph g.
ml_out_edge_iterator out_edge_iterator
ml_graph_traversal_tag traversal_category
This describes the ways in which the vertices and edges of the graph can be visited.
ml::Graph::NodeIterator vertex_iterator
A vertex iterator (obtained via vertices(g)) provides access to all of the vertices in a graph.
ml::VesselNode * vertex_descriptor
The type for vertex representative objects.
long vertices_size_type
The unsigned integer type used to represent the number of vertices in the graph.
allow_parallel_edge_tag edge_parallel_category
This describes whether the graph class allows the insertion of parallel edges (edges with the same so...
ml::VesselEdge * edge_descriptor
The type for edge representative objects.
long degree_size_type
The unsigned intergral type used for representing the number out-edges or incident edges of a vertex.
directed_tag directed_category
This type shall be convertible to directed_tag or undirected_tag.
This describes the ways in which the vertices and edges of the graph can be visited.
ml_edge_weight_map const_type
ml_vertex_id_map const_type
Since the correct std::iterator_traits rely on partial template specialization which is not supported...
ptrdiff_t difference_type
std::random_access_iterator_tag iterator_category