13#ifndef ML_GRAPH_TO_BOOST_GRAPH_H
14#define ML_GRAPH_TO_BOOST_GRAPH_H
20#include <boost/operators.hpp>
21#include <boost/graph/graph_traits.hpp>
22#include <boost/graph/properties.hpp>
23#include <boost/property_map/property_map.hpp>
36class ml_vertex_iterator;
54 public virtual incidence_graph_tag,
56 public virtual vertex_list_graph_tag
121 ml_out_edge_iterator,
135 std::vector<ml::VesselEdge*>::iterator edgeIter,
136 std::vector<ml::VesselEdge*>::iterator edgeIterEnd)
144 !((*_edgeIter)->isPred(
_vertex)) )
179 inline boost::graph_traits<ml_graph_ptr>::vertex_descriptor
180 source(graph_traits<ml_graph_ptr>::edge_descriptor e,
183 return e->predNode();
187 inline boost::graph_traits<ml_graph_ptr>::vertex_descriptor
188 target(graph_traits<ml_graph_ptr>::edge_descriptor e,
191 return e->succNode();
206 inline std::pair<boost::graph_traits<ml_graph_ptr>::out_edge_iterator,
207 boost::graph_traits<ml_graph_ptr>::out_edge_iterator>
211 return std::make_pair(
220 inline boost::graph_traits<ml_graph_ptr>::degree_size_type
224 boost::graph_traits<ml_graph_ptr>::degree_size_type count = 0;
226 std::vector<ml::VesselEdge*>::iterator edgeIter =
vertex->edges()->begin();
227 std::vector<ml::VesselEdge*>::iterator edgeIterEnd =
vertex->edges()->end();
229 while (edgeIter != edgeIterEnd)
231 if ((*edgeIter)->isPred(
vertex))
244 inline std::pair<boost::graph_traits<ml_graph_ptr>::vertex_iterator,
245 boost::graph_traits<ml_graph_ptr>::vertex_iterator>
248 return std::make_pair( g->beginNode(),
253 inline boost::graph_traits<ml_graph_ptr>::vertices_size_type
256 return static_cast<long> (g->numNodes());
261 inline boost::graph_traits<ml_graph_ptr>::vertex_descriptor
264 return g->getNode(arrayIndex);
324 std::cout <<
"edge.getWeight() = " << edge->getWeight() << std::endl;
325 return edge->getWeight();
349template<
class T,
class ValueType>
377template <
class IteratorTraits,
class IDMap>
382 typedef typename property_traits<IDMap>::key_type
key_type;
390 ml_iterator_map(
typename IteratorTraits::iterator_type i = IteratorTraits::iterator_type(),
391 const IDMap&
id = IDMap())
393 typename IteratorTraits::iterator_type
m_iter;
401template <
class IteratorTraits,
class IDMap>
402typename IteratorTraits::value_type
404 typename property_traits<IDMap>::key_type key)
408template <
class IteratorTraits,
class IDMap>
411 typename property_traits<IDMap>::key_type key,
412 const typename IteratorTraits::value_type& value)
418template <
class IteratorTraits,
class IDMap>
419typename IteratorTraits::value_type&
421 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.
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