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>
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)) )
181 inline boost::graph_traits<ml_graph_ptr>::vertex_descriptor
182 source(graph_traits<ml_graph_ptr>::edge_descriptor e,
185 return e->predNode();
189 inline boost::graph_traits<ml_graph_ptr>::vertex_descriptor
190 target(graph_traits<ml_graph_ptr>::edge_descriptor e,
193 return e->succNode();
208 inline std::pair<boost::graph_traits<ml_graph_ptr>::out_edge_iterator,
209 boost::graph_traits<ml_graph_ptr>::out_edge_iterator>
213 return std::make_pair(
222 inline boost::graph_traits<ml_graph_ptr>::degree_size_type
226 boost::graph_traits<ml_graph_ptr>::degree_size_type count = 0;
228 std::vector<ml::VesselEdge*>::iterator
edgeIter =
vertex->edges()->begin();
233 if ((*edgeIter)->isPred(
vertex))
246 inline std::pair<boost::graph_traits<ml_graph_ptr>::vertex_iterator,
247 boost::graph_traits<ml_graph_ptr>::vertex_iterator>
250 return std::make_pair( g->beginNode(),
255 inline boost::graph_traits<ml_graph_ptr>::vertices_size_type
258 return static_cast<long> (g->numNodes());
263 inline boost::graph_traits<ml_graph_ptr>::vertex_descriptor
326 std::cout <<
"edge.getWeight() = " << edge->getWeight() << std::endl;
327 return edge->getWeight();
351template<
class T,
class ValueType>
379template <
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(),
395 typename IteratorTraits::iterator_type
m_iter;
403template <
class IteratorTraits,
class IDMap>
404typename IteratorTraits::value_type
406 typename property_traits<IDMap>::key_type
key)
408 return i.m_iter[
i.m_id[
key]];
410template <
class IteratorTraits,
class IDMap>
413 typename property_traits<IDMap>::key_type
key,
414 const typename IteratorTraits::value_type& value)
417 i.m_iter[
i.m_id[
key]] = value;
420template <
class IteratorTraits,
class IDMap>
421typename IteratorTraits::value_type&
423 typename property_traits<IDMap>::key_type
key)
425 return i.m_iter[
i.m_id[
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<>
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
Forward declaration for the boost::mutex class.
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.
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 (...
void put(const ml_iterator_map< IteratorTraits, IDMap > &i, typename property_traits< IDMap >::key_type key, const typename IteratorTraits::value_type &value)
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.
IteratorTraits::value_type & at(const ml_iterator_map< IteratorTraits, IDMap > &i, typename property_traits< IDMap >::key_type key)
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 >::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 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...
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.
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