Go to the documentation of this file.
30 #ifndef vtkBoostGraphAdapter_h
31 #define vtkBoostGraphAdapter_h
49 #include <boost/version.hpp>
59 struct read_write_property_map_tag;
61 #define vtkPropertyMapMacro(T, V) \
63 struct property_traits<T*> \
65 typedef V value_type; \
66 typedef V reference; \
67 typedef vtkIdType key_type; \
68 typedef read_write_property_map_tag category; \
71 inline property_traits<T*>::reference \
74 property_traits<T*>::key_type key) \
76 return arr->GetValue(key); \
82 property_traits<T*>::key_type key, \
83 const property_traits<T*>::value_type & value) \
85 arr->InsertValue(key, value); \
136 #if defined(_MSC_VER)
146 #include <boost/config.hpp>
147 #include <boost/iterator/iterator_facade.hpp>
148 #include <boost/graph/graph_traits.hpp>
149 #include <boost/graph/properties.hpp>
150 #include <boost/graph/adjacency_iterator.hpp>
159 public iterator_facade<vtk_vertex_iterator,
161 bidirectional_traversal_tag,
169 vtkIdType dereference()
const {
return index; }
172 {
return index == other.index; }
174 void increment() { index++; }
175 void decrement() { index--; }
183 public iterator_facade<vtk_edge_iterator,
185 forward_traversal_tag,
191 directed(false), vertex(v), lastVertex(v), iter(nullptr), end(nullptr), graph(g)
211 while (vertex < lastVertex && this->graph->
GetOutDegree(vertex) == 0)
216 if (vertex < lastVertex)
235 && vertex > iter->
Target)))
254 {
return vertex == other.vertex && iter == other.iter; }
276 && vertex > iter->
Target)))
290 while (vertex < lastVertex && this->graph->
GetOutDegree(vertex) == 0)
295 if (vertex < lastVertex)
319 public iterator_facade<vtk_out_edge_pointer_iterator,
321 bidirectional_traversal_tag,
332 g->GetOutEdges(vertex, iter, nedges);
344 {
return iter == other.iter; }
346 void increment() { iter++; }
347 void decrement() { iter--; }
356 public iterator_facade<vtk_in_edge_pointer_iterator,
358 bidirectional_traversal_tag,
369 g->GetInEdges(vertex, iter, nedges);
381 {
return iter == other.iter; }
383 void increment() { iter++; }
384 void decrement() { iter--; }
399 public virtual bidirectional_graph_tag,
400 public virtual edge_list_graph_tag,
401 public virtual vertex_list_graph_tag,
402 public virtual adjacency_graph_tag { };
422 typedef adjacency_iterator_generator<
vtkGraph*,
426 #if BOOST_VERSION >= 104500
428 struct graph_property_type<
vtkGraph* > {
429 typedef no_property
type;
443 #if BOOST_VERSION >= 104500
445 struct graph_bundle_type<
vtkGraph* > {
446 typedef no_property
type;
495 #if BOOST_VERSION >= 104500
499 : graph_property_type< vtkGraph* > { };
504 : graph_property_type< vtkGraph* > { };
527 #if BOOST_VERSION >= 104500
531 : graph_bundle_type< vtkGraph* > { };
536 : graph_bundle_type< vtkGraph* > { };
589 #if BOOST_VERSION >= 104500
593 : graph_property_type< vtkGraph* > { };
598 : graph_property_type< vtkGraph* > { };
621 #if BOOST_VERSION >= 104500
625 : graph_bundle_type< vtkGraph* > { };
630 : graph_bundle_type< vtkGraph* > { };
667 #if BOOST_VERSION >= 104500
671 : graph_property_type< vtkDirectedGraph* > { };
676 : graph_property_type< vtkDirectedGraph* > { };
699 #if BOOST_VERSION >= 104500
703 : graph_bundle_type< vtkDirectedGraph* > { };
708 : graph_bundle_type< vtkDirectedGraph* > { };
745 #if BOOST_VERSION >= 104500
749 : graph_property_type< vtkUndirectedGraph* > { };
754 : graph_property_type< vtkUndirectedGraph* > { };
777 #if BOOST_VERSION >= 104500
781 : graph_bundle_type< vtkUndirectedGraph* > { };
786 : graph_bundle_type< vtkUndirectedGraph* > { };
852 return std::make_pair( Iter(start),
873 std::pair<Iter, Iter> p = std::make_pair( Iter(g, u), Iter(g, u,
true) );
885 std::pair<Iter, Iter> p = std::make_pair( Iter(g, u), Iter(g, u,
true) );
898 std::pair<OutEdgeIter, OutEdgeIter> out =
out_edges(u, g);
899 return std::make_pair( Iter(out.first, &g), Iter(out.second, &g) );
953 return std::make_pair(e,
true);
971 return std::make_pair(e,
true);
1002 template<
typename PMap>
1019 template<
typename PMap>
1028 template<
typename PMap>
1042 template<
typename PMap>
1059 template<
typename PMap>
1068 template<
typename PMap>
1104 template<
typename PMap>
1117 template<
typename PMap>
1126 template<
typename PMap>
1190 #if BOOST_VERSION > 104000
1191 #include <boost/property_map/vector_property_map.hpp>
1193 #include <boost/vector_property_map.hpp>
1197 #endif // vtkBoostGraphAdapter_h
boost::graph_traits< vtkGraph * >::degree_size_type out_degree(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)
virtual vtkVariant GetVariantValue(vtkIdType valueIdx)
Retrieve value from the array as a variant.
An editable directed graph.
std::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
void put(vtkGraphPropertyMapMultiplier< PMap > multi, const typename property_traits< PMap >::key_type &key, const typename property_traits< PMap >::value_type &value)
helper for the vtkGraph class that allows the graph to be distributed across multiple memory spaces.
vtkEdgeType AddEdge(vtkIdType u, vtkIdType v)
Adds a directed edge from u to v, where u and v are vertex indices, and returns a vtkEdgeType structu...
vtkDistributedGraphHelper * GetDistributedGraphHelper()
Retrieves the distributed graph helper for this graph.
reference operator[](const key_type &key) const
friend class iterator_core_access
std::pair< boost::graph_traits< vtkGraph * >::adjacency_iterator, boost::graph_traits< vtkGraph * >::adjacency_iterator > adjacent_vertices(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
An editable undirected graph.
vtkGraphEdgePropertyMapHelper(PMap m)
void SetTuple1(vtkIdType tupleIdx, double value)
These methods are included as convenience for the wrappers.
vtkGraphVertexPropertyMapHelper(PMap m)
std::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)
vtk_edge_iterator(vtkGraph *g=0, vtkIdType v=0)
read_write_property_map_tag category
property_traits< PMap >::category category
dynamic, self-adjusting array of float
read_write_property_map_tag category
virtual vtkIdType GetNumberOfVertices()
The number of vertices in the graph.
vtkGraphPropertyMapMultiplier(PMap m, float multi=1)
property_traits< PMap >::value_type value_type
Forward declaration required for Boost serialization.
virtual vtkIdType GetNumberOfEdges()
The number of edges in the graph.
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)
virtual void InsertVariantValue(vtkIdType valueIdx, vtkVariant value)=0
Insert a value into the array from a variant.
std::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 >::category category
property_traits< PMap >::key_type key_type
property_traits< PMap >::category category
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
A rooted tree data structure.
vtkEdgeType AddEdge(vtkIdType u, vtkIdType v)
Adds an undirected edge from u to v, where u and v are vertex indices, and returns a vtkEdgeType stru...
undirected_tag directed_category
property_traits< PMap >::reference reference
directed_tag directed_category
vtkIdType GetVertexOwner(vtkIdType v) const
Returns owner of vertex v, by extracting top ceil(log2 P) bits of v.
std::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)
vtk_in_edge_pointer_iterator(vtkGraph *g=0, vtkIdType v=0, bool end=false)
vtk_vertex_iterator vertex_iterator
virtual vtkIdType GetOutDegree(vtkIdType v)
The number of outgoing edges from vertex v.
static vtkMutableUndirectedGraph * SafeDownCast(vtkObjectBase *o)
virtual vtkIdType GetInDegree(vtkIdType v)
The number of incoming edges to vertex v.
double get(vtkDataArray *const &arr, vtkIdType key)
static vtkInformationIntegerKey * DATA_PIECE_NUMBER()
property_traits< PMap >::reference reference
std::pair< boost::graph_traits< vtkGraph * >::vertex_iterator, boost::graph_traits< vtkGraph * >::vertex_iterator > vertices(vtkGraph *g)
void RemoveEdge(vtkIdType e)
Removes the edge from the graph.
readable_property_map_tag category
virtual vtkIdType GetDegree(vtkIdType v)
The total of all incoming and outgoing vertices for vertex v.
vtkGraphIndexMap get(edge_index_t, vtkGraph *)
reference operator[](const key_type &key) const
dynamic, self-adjusting array of int
vtkIdType AddVertex()
Adds a vertex to the graph and returns the index of the new vertex.
A atomic type representing the union of many types.
vtkIdType MakeDistributedId(int owner, vtkIdType local)
Builds a distributed ID consisting of the given owner and the local ID.
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)
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)
Initializes the out edge iterator to iterate over all outgoing edges of vertex v.
property_traits< PMap >::value_type value_type
vtkIdType vertices_size_type
vtkEdgeType edge_descriptor
property_traits< PMap >::value_type value_type
dynamic, self-adjusting array of vtkIdType
virtual vtkInformation * GetInformation()
Set/Get the information object associated with this data object.
static vtkDirectedGraph * SafeDownCast(vtkObjectBase *o)
void RemoveEdge(vtkIdType e)
Removes the edge from the graph.
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
Returns owner of edge with ID e_id, by extracting top ceil(log2 P) bits of e_id.
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
vtkIdType AddVertex()
Adds a vertex to the graph and returns the index of the new vertex.
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
double GetTuple1(vtkIdType tupleIdx)
These methods are included as convenience for the wrappers.
allow_parallel_edge_tag edge_parallel_category
vtkPropertyMapMacro(vtkIntArray, int) vtkPropertyMapMacro(vtkIdTypeArray
adjacency_iterator_generator< vtkGraph *, vertex_descriptor, out_edge_iterator >::type adjacency_iterator