43#ifndef vtkBoostGraphAdapter_h
44#define vtkBoostGraphAdapter_h
62#include <boost/version.hpp>
74struct read_write_property_map_tag;
76#define vtkPropertyMapMacro(T, V) \
78 struct property_traits<T*> \
80 typedef V value_type; \
81 typedef V reference; \
82 typedef vtkIdType key_type; \
83 typedef read_write_property_map_tag category; \
86 inline property_traits<T*>::reference get(T* const& arr, property_traits<T*>::key_type key) \
88 return arr->GetValue(key); \
92 T* arr, property_traits<T*>::key_type key, const property_traits<T*>::value_type& value) \
94 arr->InsertValue(key, value); \
153#include <boost/config.hpp>
154#include <boost/version.hpp>
156#if BOOST_VERSION > 107300 && BOOST_VERSION < 107600
157#define BOOST_ALLOW_DEPRECATED_HEADERS
158#define BOOST_BIND_GLOBAL_PLACEHOLDERS
161#include <boost/graph/adjacency_iterator.hpp>
162#include <boost/graph/graph_traits.hpp>
163#include <boost/graph/properties.hpp>
164#include <boost/iterator/iterator_facade.hpp>
174 :
public iterator_facade<vtk_vertex_iterator, vtkIdType, bidirectional_traversal_tag,
175 const vtkIdType&, vtkIdType>
184 const vtkIdType& dereference()
const {
return index; }
188 void increment() { index++; }
189 void decrement() { index--; }
197 :
public iterator_facade<vtk_edge_iterator, vtkEdgeType, forward_traversal_tag,
198 const vtkEdgeType&, vtkIdType>
211 lastVertex = graph->GetNumberOfVertices();
216 this->graph ? this->graph->GetDistributedGraphHelper() :
nullptr;
224 if (graph !=
nullptr)
227 while (vertex < lastVertex && this->graph->GetOutDegree(vertex) == 0)
232 if (vertex < lastVertex)
237 graph->GetOutEdges(vertex, iter, nedges);
247 || (((helper && myRank == helper->
GetVertexOwner(iter->Target)) || !helper) &&
248 vertex > iter->Target))
273 return vertex == other.vertex && iter == other.iter;
282 vtkDistributedGraphHelper* helper =
283 this->graph ? this->graph->GetDistributedGraphHelper() :
nullptr;
289 while (iter !=
nullptr &&
293 || (((helper && myRank == helper->
GetVertexOwner(iter->Target)) || !helper) &&
294 vertex > iter->Target)))
309 while (vertex < lastVertex && this->graph->GetOutDegree(vertex) == 0)
314 if (vertex < lastVertex)
317 graph->GetOutEdges(vertex, iter, nedges);
327 void RecalculateEdge()
331 edge = vtkEdgeType(vertex, iter->Target, iter->Id);
338 const vtkOutEdgeType* iter;
339 const vtkOutEdgeType* end;
347 :
public iterator_facade<vtk_out_edge_pointer_iterator, vtkEdgeType, bidirectional_traversal_tag,
348 const vtkEdgeType&, ptrdiff_t>
358 g->GetOutEdges(vertex, iter, nedges);
388 void RecalculateEdge()
392 edge = vtkEdgeType(vertex, iter->Target, iter->Id);
397 const vtkOutEdgeType* iter;
404 :
public iterator_facade<vtk_in_edge_pointer_iterator, vtkEdgeType, bidirectional_traversal_tag,
405 const vtkEdgeType&, ptrdiff_t>
415 g->GetInEdges(vertex, iter, nedges);
445 void RecalculateEdge()
449 edge = vtkEdgeType(iter->Source, vertex, iter->Id);
454 const vtkInEdgeType* iter;
465VTK_ABI_NAMESPACE_BEGIN
468 :
public virtual bidirectional_graph_tag
469 ,
public virtual edge_list_graph_tag
470 ,
public virtual vertex_list_graph_tag
471 ,
public virtual adjacency_graph_tag
496 typedef adjacency_iterator_generator<vtkGraph*, vertex_descriptor, out_edge_iterator>::type
500#if BOOST_VERSION >= 104500
502struct graph_property_type<
vtkGraph*>
504 typedef no_property type;
520#if BOOST_VERSION >= 104500
524 typedef no_property type;
578#if BOOST_VERSION >= 104500
581struct graph_property_type<
vtkDirectedGraph*> : graph_property_type<vtkGraph*>
587struct graph_property_type<
vtkDirectedGraph*
const> : graph_property_type<vtkGraph*>
616#if BOOST_VERSION >= 104500
625struct graph_bundle_type<
vtkDirectedGraph*
const> : graph_bundle_type<vtkGraph*>
658struct graph_traits<
vtkTree*> : graph_traits<vtkDirectedGraph*>
664struct graph_traits<const
vtkTree*> : graph_traits<vtkTree*>
670struct graph_traits<
vtkTree*
const> : graph_traits<vtkTree*>
694#if BOOST_VERSION >= 104500
732#if BOOST_VERSION >= 104500
790#if BOOST_VERSION >= 104500
813 : vertex_property_type<vtkDirectedGraph*>
829#if BOOST_VERSION >= 104500
887#if BOOST_VERSION >= 104500
897 : graph_property_type<vtkUndirectedGraph*>
911 : vertex_property_type<vtkUndirectedGraph*>
924 : edge_property_type<vtkUndirectedGraph*>
928#if BOOST_VERSION >= 104500
951 : vertex_bundle_type<vtkUndirectedGraph*>
996inline std::pair<boost::graph_traits<vtkGraph*>::vertex_iterator,
1011inline std::pair<boost::graph_traits<vtkGraph*>::edge_iterator,
1019inline std::pair<boost::graph_traits<vtkGraph*>::out_edge_iterator,
1024 std::pair<Iter, Iter> p = std::make_pair(Iter(g, u), Iter(g, u,
true));
1028inline std::pair<boost::graph_traits<vtkGraph*>::in_edge_iterator,
1033 std::pair<Iter, Iter> p = std::make_pair(Iter(g, u), Iter(g, u,
true));
1037inline std::pair<boost::graph_traits<vtkGraph*>::adjacency_iterator,
1043 std::pair<OutEdgeIter, OutEdgeIter> out =
out_edges(u, g);
1044 return std::make_pair(Iter(out.first, &g), Iter(out.second, &g));
1081inline std::pair<boost::graph_traits<vtkMutableDirectedGraph*>::edge_descriptor,
bool>
add_edge(
1086 return std::make_pair(e,
true);
1095inline std::pair<boost::graph_traits<vtkMutableUndirectedGraph*>::edge_descriptor,
bool>
add_edge(
1101 return std::make_pair(e,
true);
1106VTK_ABI_NAMESPACE_BEGIN
1115VTK_ABI_NAMESPACE_END
1136VTK_ABI_NAMESPACE_BEGIN
1137template <
typename PMap>
1153VTK_ABI_NAMESPACE_END
1155template <
typename PMap>
1159 return get(helper.
pmap, key.Id);
1162template <
typename PMap>
1166 put(helper.
pmap, key.Id, value);
1173VTK_ABI_NAMESPACE_BEGIN
1174template <
typename PMap>
1190VTK_ABI_NAMESPACE_END
1192template <
typename PMap>
1199template <
typename PMap>
1210VTK_ABI_NAMESPACE_BEGIN
1214VTK_ABI_NAMESPACE_END
1234VTK_ABI_NAMESPACE_BEGIN
1235template <
typename PMap>
1251VTK_ABI_NAMESPACE_END
1253template <
typename PMap>
1260template <
typename PMap>
1278struct property_map<
vtkDirectedGraph*, vertex_index_t> : property_map<vtkGraph*, vertex_index_t>
1317 : property_map<vtkDirectedGraph*, vertex_index_t>
1323 : property_map<vtkUndirectedGraph*, vertex_index_t>
1329 : property_map<vtkDirectedGraph*, edge_index_t>
1335 : property_map<vtkUndirectedGraph*, edge_index_t>
1340#if BOOST_VERSION > 104000
1341#include <boost/property_map/vector_property_map.hpp>
1343#include <boost/vector_property_map.hpp>
property_traits< PMap >::reference reference
property_traits< PMap >::category category
property_traits< PMap >::value_type value_type
vtkGraphEdgePropertyMapHelper(PMap m)
reference operator[](const key_type &key) const
vtkGraphPropertyMapMultiplier(PMap m, float multi=1)
property_traits< PMap >::value_type value_type
property_traits< PMap >::reference reference
property_traits< PMap >::key_type key_type
property_traits< PMap >::category category
property_traits< PMap >::reference reference
property_traits< PMap >::value_type value_type
vtkGraphVertexPropertyMapHelper(PMap m)
reference operator[](const key_type &key) const
property_traits< PMap >::category category
friend class iterator_core_access
vtk_edge_iterator(vtkGraph *g=nullptr, vtkIdType v=0)
friend class iterator_core_access
vtk_in_edge_pointer_iterator(vtkGraph *g=nullptr, vtkIdType v=0, bool end=false)
friend class iterator_core_access
vtk_out_edge_pointer_iterator(vtkGraph *g=nullptr, vtkIdType v=0, bool end=false)
friend class iterator_core_access
vtk_vertex_iterator(vtkIdType i=0)
Abstract superclass for all arrays.
virtual vtkVariant GetVariantValue(vtkIdType valueIdx)
Retrieve value from the array as a variant.
virtual void InsertVariantValue(vtkIdType valueIdx, vtkVariant value)=0
Insert a value into the array from a variant.
void SetTuple1(vtkIdType tupleIdx, double value)
These methods are included as convenience for the wrappers.
double GetTuple1(vtkIdType tupleIdx)
These methods are included as convenience for the wrappers.
virtual vtkInformation * GetInformation()
Set/Get the information object associated with this data object.
static vtkDirectedGraph * SafeDownCast(vtkObjectBase *o)
helper for the vtkGraph class that allows the graph to be distributed across multiple memory spaces.
vtkIdType GetEdgeOwner(vtkIdType e_id) const
Returns owner of edge with ID e_id, by extracting top ceil(log2 P) bits of e_id.
vtkIdType MakeDistributedId(int owner, vtkIdType local)
Builds a distributed ID consisting of the given owner and the local ID.
vtkIdType GetVertexOwner(vtkIdType v) const
Returns owner of vertex v, by extracting top ceil(log2 P) bits of v.
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
Base class for graph data types.
virtual vtkIdType GetOutDegree(vtkIdType v)
The number of outgoing edges from vertex v.
virtual vtkIdType GetNumberOfVertices()
The number of vertices in the graph.
vtkDistributedGraphHelper * GetDistributedGraphHelper()
Retrieves the distributed graph helper for this graph.
virtual vtkIdType GetNumberOfEdges()
The number of edges in the graph.
virtual vtkIdType GetInDegree(vtkIdType v)
The number of incoming edges to vertex v.
virtual vtkIdType GetDegree(vtkIdType v)
The total of all incoming and outgoing vertices for vertex v.
dynamic, self-adjusting array of vtkIdType
dynamic, self-adjusting array of int
An editable directed graph.
void RemoveEdge(vtkIdType e)
Removes the edge from the graph.
static vtkMutableDirectedGraph * SafeDownCast(vtkObjectBase *o)
vtkIdType AddVertex()
Adds a vertex to the graph and returns the index of the new vertex.
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...
An editable undirected graph.
static vtkMutableUndirectedGraph * SafeDownCast(vtkObjectBase *o)
void RemoveEdge(vtkIdType e)
Removes the edge from the graph.
vtkIdType AddVertex()
Adds a vertex to the graph and returns the index of the new vertex.
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...
A rooted tree data structure.
A type representing the union of many types.
Forward declaration required for Boost serialization.
bool has_no_edges(vtkGraph *g)
void remove_edge(graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *g)
double get(vtkDataArray *const &arr, vtkIdType key)
void put(vtkDataArray *arr, vtkIdType key, const double &value)
directed_tag directed_category
vtk_in_edge_pointer_iterator in_edge_iterator
vtkIdType edges_size_type
allow_parallel_edge_tag edge_parallel_category
vtkIdType vertex_descriptor
vtk_vertex_iterator vertex_iterator
vtk_out_edge_pointer_iterator out_edge_iterator
static vertex_descriptor null_vertex()
adjacency_iterator_generator< vtkGraph *, vertex_descriptor, out_edge_iterator >::type adjacency_iterator
vtkIdType vertices_size_type
vtkGraph_traversal_category traversal_category
vtkEdgeType edge_descriptor
vtkIdType degree_size_type
vtk_edge_iterator edge_iterator
static edge_descriptor null_edge()
undirected_tag directed_category
vtkGraphIndexMap const_type
vtkGraphIndexMap const_type
read_write_property_map_tag category
read_write_property_map_tag category
readable_property_map_tag category
readable_property_map_tag category
boost::graph_traits< vtkDirectedGraph * >::degree_size_type in_degree(boost::graph_traits< vtkDirectedGraph * >::vertex_descriptor u, vtkDirectedGraph *g)
std::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
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)
boost::graph_traits< vtkGraph * >::vertices_size_type num_vertices(vtkGraph *g)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define vtkPropertyMapMacro(T, V)
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)
std::pair< boost::graph_traits< vtkGraph * >::vertex_iterator, boost::graph_traits< vtkGraph * >::vertex_iterator > vertices(vtkGraph *g)
boost::graph_traits< vtkMutableDirectedGraph * >::vertex_descriptor add_vertex(vtkMutableDirectedGraph *g)
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)
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)
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
boost::graph_traits< vtkGraph * >::degree_size_type out_degree(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
boost::graph_traits< vtkGraph * >::degree_size_type degree(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
boost::graph_traits< vtkGraph * >::edges_size_type num_edges(vtkGraph *g)