Go to the documentation of this file.
29 #ifndef vtkBoostGraphAdapter_h
30 #define vtkBoostGraphAdapter_h
48 #include <boost/version.hpp>
58 struct read_write_property_map_tag;
60 #define vtkPropertyMapMacro(T, V) \
62 struct property_traits<T*> \
64 typedef V value_type; \
65 typedef V reference; \
66 typedef vtkIdType key_type; \
67 typedef read_write_property_map_tag category; \
70 inline property_traits<T*>::reference \
73 property_traits<T*>::key_type key) \
75 return arr->GetValue(key); \
81 property_traits<T*>::key_type key, \
82 const property_traits<T*>::value_type & value) \
84 arr->InsertValue(key, value); \
135 #if defined(_MSC_VER)
143 #include <vtksys/stl/utility>
145 #include <boost/config.hpp>
146 #include <boost/iterator/iterator_facade.hpp>
147 #include <boost/graph/graph_traits.hpp>
148 #include <boost/graph/properties.hpp>
149 #include <boost/graph/adjacency_iterator.hpp>
158 public iterator_facade<vtk_vertex_iterator,
160 bidirectional_traversal_tag,
168 vtkIdType dereference()
const {
return index; }
171 {
return index == other.index; }
173 void increment() { index++; }
174 void decrement() { index--; }
182 public iterator_facade<vtk_edge_iterator,
184 forward_traversal_tag,
190 directed(false), vertex(
v), lastVertex(
v), iter(0), end(0), graph(
g)
210 while (vertex < lastVertex && this->graph->
GetOutDegree(vertex) == 0)
215 if (vertex < lastVertex)
232 && vertex > iter->
Target)))
250 {
return vertex == other.vertex && iter == other.iter; }
272 && vertex > iter->
Target)))
286 while (vertex < lastVertex && this->graph->
GetOutDegree(vertex) == 0)
291 if (vertex < lastVertex)
315 public iterator_facade<vtk_out_edge_pointer_iterator,
317 bidirectional_traversal_tag,
328 g->GetOutEdges(vertex, iter, nedges);
340 {
return iter == other.iter; }
342 void increment() { iter++; }
343 void decrement() { iter--; }
352 public iterator_facade<vtk_in_edge_pointer_iterator,
354 bidirectional_traversal_tag,
365 g->GetInEdges(vertex, iter, nedges);
377 {
return iter == other.iter; }
379 void increment() { iter++; }
380 void decrement() { iter--; }
395 public virtual bidirectional_graph_tag,
396 public virtual edge_list_graph_tag,
397 public virtual vertex_list_graph_tag,
398 public virtual adjacency_graph_tag { };
418 typedef adjacency_iterator_generator<
vtkGraph*,
422 #if BOOST_VERSION >= 104500
424 struct graph_property_type<
vtkGraph* > {
425 typedef no_property
type;
439 #if BOOST_VERSION >= 104500
441 struct graph_bundle_type<
vtkGraph* > {
442 typedef no_property
type;
458 return ((
g->GetNumberOfEdges() > 0) ?
false :
true);
491 #if BOOST_VERSION >= 104500
495 : graph_property_type< vtkGraph* > { };
500 : graph_property_type< vtkGraph* > { };
523 #if BOOST_VERSION >= 104500
527 : graph_bundle_type< vtkGraph* > { };
532 : graph_bundle_type< vtkGraph* > { };
585 #if BOOST_VERSION >= 104500
589 : graph_property_type< vtkGraph* > { };
594 : graph_property_type< vtkGraph* > { };
617 #if BOOST_VERSION >= 104500
621 : graph_bundle_type< vtkGraph* > { };
626 : graph_bundle_type< vtkGraph* > { };
663 #if BOOST_VERSION >= 104500
667 : graph_property_type< vtkDirectedGraph* > { };
672 : graph_property_type< vtkDirectedGraph* > { };
695 #if BOOST_VERSION >= 104500
699 : graph_bundle_type< vtkDirectedGraph* > { };
704 : graph_bundle_type< vtkDirectedGraph* > { };
741 #if BOOST_VERSION >= 104500
745 : graph_property_type< vtkUndirectedGraph* > { };
750 : graph_property_type< vtkUndirectedGraph* > { };
773 #if BOOST_VERSION >= 104500
777 : graph_bundle_type< vtkUndirectedGraph* > { };
782 : graph_bundle_type< vtkUndirectedGraph* > { };
834 inline vtksys_stl::pair<
848 return vtksys_stl::make_pair( Iter(
start),
849 Iter(
start +
g->GetNumberOfVertices()) );
852 inline vtksys_stl::pair<
858 return vtksys_stl::make_pair( Iter(
g), Iter(
g,
g->GetNumberOfVertices()) );
861 inline vtksys_stl::pair<
869 vtksys_stl::pair<Iter, Iter>
p = vtksys_stl::make_pair( Iter(
g, u), Iter(
g, u,
true) );
873 inline vtksys_stl::pair<
881 vtksys_stl::pair<Iter, Iter>
p = vtksys_stl::make_pair( Iter(
g, u), Iter(
g, u,
true) );
885 inline vtksys_stl::pair<
894 vtksys_stl::pair<OutEdgeIter, OutEdgeIter> out =
out_edges(u,
g);
895 return vtksys_stl::make_pair( Iter(out.first, &
g), Iter(out.second, &
g) );
901 return g->GetNumberOfVertices();
907 return g->GetNumberOfEdges();
915 return g->GetOutDegree(u);
923 return g->GetInDegree(u);
931 return g->GetDegree(u);
937 return g->AddVertex();
940 inline vtksys_stl::pair<
949 return vtksys_stl::make_pair(e,
true);
955 return g->AddVertex();
958 inline vtksys_stl::pair<
967 return vtksys_stl::make_pair(e,
true);
998 template<
typename PMap>
1010 template<
typename PMap>
1019 template<
typename PMap>
1055 template<
typename PMap>
1068 template<
typename PMap>
1077 template<
typename PMap>
1141 #if BOOST_VERSION > 104000
1142 #include <boost/property_map/vector_property_map.hpp>
1144 #include <boost/vector_property_map.hpp>
1148 #endif // vtkBoostGraphAdapter_h
boost::graph_traits< vtkGraph * >::degree_size_type out_degree(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::in_edge_iterator, boost::graph_traits< vtkGraph * >::in_edge_iterator > in_edges(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
static edge_descriptor null_edge()
void remove_edge(graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *g)
An editable directed graph.
helper for the vtkGraph class that allows the graph to be distributed across multiple memory spaces.
vtkDistributedGraphHelper * GetDistributedGraphHelper()
friend class iterator_core_access
An editable undirected graph.
vtkGraphEdgePropertyMapHelper(PMap m)
vtk_edge_iterator(vtkGraph *g=0, vtkIdType v=0)
read_write_property_map_tag category
dynamic, self-adjusting array of float
read_write_property_map_tag category
virtual vtkIdType GetNumberOfVertices()
vtkGraphPropertyMapMultiplier(PMap m, float multi=1)
void put(vtkGraphPropertyMapMultiplier< PMap > multi, const typename property_traits< PMap >::key_type key, const typename property_traits< PMap >::value_type &value)
Forward declaration required for Boost serialization.
double GetTuple1(vtkIdType i)
friend class iterator_core_access
abstract superclass for arrays of numeric data
void put(vtkDataArray *arr, vtkIdType key, const double &value)
bool has_no_edges(vtkGraph *g)
property_traits< PMap >::category category
vtksys_stl::pair< boost::graph_traits< vtkMutableDirectedGraph * >::edge_descriptor, bool > add_edge(boost::graph_traits< vtkMutableDirectedGraph * >::vertex_descriptor u, boost::graph_traits< vtkMutableDirectedGraph * >::vertex_descriptor v, vtkMutableDirectedGraph *g)
property_traits< PMap >::key_type key_type
property_traits< PMap >::category category
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::adjacency_iterator, boost::graph_traits< vtkGraph * >::adjacency_iterator > adjacent_vertices(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
A rooted tree data structure.
virtual void InsertVariantValue(vtkIdType idx, vtkVariant value)
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
undirected_tag directed_category
directed_tag directed_category
vtkIdType GetVertexOwner(vtkIdType v) const
GLsizei const GLfloat * value
vtk_in_edge_pointer_iterator(vtkGraph *g=0, vtkIdType v=0, bool end=false)
vtk_vertex_iterator vertex_iterator
virtual vtkIdType GetOutDegree(vtkIdType v)
static vtkMutableUndirectedGraph * SafeDownCast(vtkObjectBase *o)
double get(vtkDataArray *const &arr, vtkIdType key)
static vtkInformationIntegerKey * DATA_PIECE_NUMBER()
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::out_edge_iterator, boost::graph_traits< vtkGraph * >::out_edge_iterator > out_edges(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
property_traits< PMap >::reference reference
void RemoveEdge(vtkIdType e)
readable_property_map_tag category
vtkGraphIndexMap get(edge_index_t, vtkGraph *)
dynamic, self-adjusting array of int
A atomic type representing the union of many types.
void SetTuple1(vtkIdType i, double value)
vtkIdType MakeDistributedId(int owner, vtkIdType local)
vtkGraphIndexMap const_type
boost::graph_traits< vtkGraph * >::degree_size_type degree(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
vtk_out_edge_pointer_iterator(vtkGraph *g=0, vtkIdType v=0, bool end=false)
boost::graph_traits< vtkMutableDirectedGraph * >::vertex_descriptor add_vertex(vtkMutableDirectedGraph *g)
virtual vtkVariant GetVariantValue(vtkIdType idx)
vtk_vertex_iterator(vtkIdType i=0)
vtk_in_edge_pointer_iterator in_edge_iterator
Abstract superclass for all arrays.
boost::graph_traits< vtkGraph * >::vertices_size_type num_vertices(vtkGraph *g)
vtk_out_edge_pointer_iterator out_edge_iterator
virtual void GetOutEdges(vtkIdType v, vtkOutEdgeIterator *it)
property_traits< PMap >::value_type value_type
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::vertex_iterator, boost::graph_traits< vtkGraph * >::vertex_iterator > vertices(vtkGraph *g)
vtkIdType vertices_size_type
vtkEdgeType edge_descriptor
property_traits< PMap >::value_type value_type
dynamic, self-adjusting array of vtkIdType
virtual vtkInformation * GetInformation()
static vtkDirectedGraph * SafeDownCast(vtkObjectBase *o)
void RemoveEdge(vtkIdType e)
vtkIdType edges_size_type
vtkGraphIndexMap const_type
vtkIdType degree_size_type
boost::graph_traits< vtkGraph * >::edges_size_type num_edges(vtkGraph *g)
static vertex_descriptor null_vertex()
dynamic, self-adjusting array of double
vtkIdType vertex_descriptor
static vtkMutableDirectedGraph * SafeDownCast(vtkObjectBase *o)
friend class iterator_core_access
vtkGraph_traversal_category traversal_category
Base class for graph data types.
vtkIdType GetEdgeOwner(vtkIdType e_id) const
readable_property_map_tag category
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtk_edge_iterator edge_iterator
GLuint GLuint GLsizei GLenum type
property_traits< PMap >::reference reference
boost::graph_traits< vtkDirectedGraph * >::degree_size_type in_degree(boost::graph_traits< vtkDirectedGraph * >::vertex_descriptor u, vtkDirectedGraph *g)
friend class iterator_core_access
allow_parallel_edge_tag edge_parallel_category
vtkPropertyMapMacro(vtkIntArray, int) vtkPropertyMapMacro(vtkIdTypeArray
adjacency_iterator_generator< vtkGraph *, vertex_descriptor, out_edge_iterator >::type adjacency_iterator