14#ifndef vtkBoostGraphAdapter_h
15#define vtkBoostGraphAdapter_h
33#include <boost/version.hpp>
45struct read_write_property_map_tag;
47#define vtkPropertyMapMacro(T, V) \
49 struct property_traits<T*> \
51 typedef V value_type; \
52 typedef V reference; \
53 typedef vtkIdType key_type; \
54 typedef read_write_property_map_tag category; \
57 inline property_traits<T*>::reference get(T* const& arr, property_traits<T*>::key_type key) \
59 return arr->GetValue(key); \
63 T* arr, property_traits<T*>::key_type key, const property_traits<T*>::value_type& value) \
65 arr->InsertValue(key, value); \
124#include <boost/config.hpp>
125#include <boost/version.hpp>
127#if BOOST_VERSION > 107300 && BOOST_VERSION < 107600
128#define BOOST_ALLOW_DEPRECATED_HEADERS
129#define BOOST_BIND_GLOBAL_PLACEHOLDERS
132#include <boost/graph/adjacency_iterator.hpp>
133#include <boost/graph/graph_traits.hpp>
134#include <boost/graph/properties.hpp>
135#include <boost/iterator/iterator_facade.hpp>
145 :
public iterator_facade<vtk_vertex_iterator, vtkIdType, bidirectional_traversal_tag,
146 const vtkIdType&, vtkIdType>
155 const vtkIdType& dereference()
const {
return index; }
157 bool equal(
const vtk_vertex_iterator& other)
const {
return index == other.index; }
159 void increment() { index++; }
160 void decrement() { index--; }
168 :
public iterator_facade<vtk_edge_iterator, vtkEdgeType, forward_traversal_tag,
169 const vtkEdgeType&, vtkIdType>
195 if (graph !=
nullptr)
198 while (vertex < lastVertex && this->graph->
GetOutDegree(vertex) == 0)
203 if (vertex < lastVertex)
242 bool equal(
const vtk_edge_iterator& other)
const
244 return vertex == other.vertex && iter == other.iter;
260 while (iter !=
nullptr &&
280 while (vertex < lastVertex && this->graph->
GetOutDegree(vertex) == 0)
285 if (vertex < lastVertex)
298 void RecalculateEdge()
318 :
public iterator_facade<vtk_out_edge_pointer_iterator, vtkEdgeType, bidirectional_traversal_tag,
319 const vtkEdgeType&, ptrdiff_t>
329 g->GetOutEdges(vertex, iter, nedges);
345 bool equal(
const vtk_out_edge_pointer_iterator& other)
const {
return iter == other.iter; }
359 void RecalculateEdge()
375 :
public iterator_facade<vtk_in_edge_pointer_iterator, vtkEdgeType, bidirectional_traversal_tag,
376 const vtkEdgeType&, ptrdiff_t>
386 g->GetInEdges(vertex, iter, nedges);
402 bool equal(
const vtk_in_edge_pointer_iterator& other)
const {
return iter == other.iter; }
416 void RecalculateEdge()
436VTK_ABI_NAMESPACE_BEGIN
439 :
public virtual bidirectional_graph_tag
440 ,
public virtual edge_list_graph_tag
441 ,
public virtual vertex_list_graph_tag
442 ,
public virtual adjacency_graph_tag
467 typedef adjacency_iterator_generator<vtkGraph*, vertex_descriptor, out_edge_iterator>::type
471#if BOOST_VERSION >= 104500
473struct graph_property_type<
vtkGraph*>
475 typedef no_property type;
491#if BOOST_VERSION >= 104500
495 typedef no_property type;
549#if BOOST_VERSION >= 104500
552struct graph_property_type<
vtkDirectedGraph*> : graph_property_type<vtkGraph*>
558struct graph_property_type<
vtkDirectedGraph*
const> : graph_property_type<vtkGraph*>
587#if BOOST_VERSION >= 104500
596struct graph_bundle_type<
vtkDirectedGraph*
const> : graph_bundle_type<vtkGraph*>
629struct graph_traits<
vtkTree*> : graph_traits<vtkDirectedGraph*>
635struct graph_traits<const
vtkTree*> : graph_traits<vtkTree*>
641struct graph_traits<
vtkTree*
const> : graph_traits<vtkTree*>
665#if BOOST_VERSION >= 104500
703#if BOOST_VERSION >= 104500
761#if BOOST_VERSION >= 104500
784 : vertex_property_type<vtkDirectedGraph*>
800#if BOOST_VERSION >= 104500
858#if BOOST_VERSION >= 104500
868 : graph_property_type<vtkUndirectedGraph*>
882 : vertex_property_type<vtkUndirectedGraph*>
895 : edge_property_type<vtkUndirectedGraph*>
899#if BOOST_VERSION >= 104500
922 : vertex_bundle_type<vtkUndirectedGraph*>
955inline boost::graph_traits<vtkGraph*>::vertex_descriptor
source(
956 boost::graph_traits<vtkGraph*>::edge_descriptor e,
vtkGraph*)
961inline boost::graph_traits<vtkGraph*>::vertex_descriptor
target(
962 boost::graph_traits<vtkGraph*>::edge_descriptor e,
vtkGraph*)
967inline std::pair<boost::graph_traits<vtkGraph*>::vertex_iterator,
968 boost::graph_traits<vtkGraph*>::vertex_iterator>
971 typedef boost::graph_traits<vtkGraph*>::vertex_iterator Iter;
982inline std::pair<boost::graph_traits<vtkGraph*>::edge_iterator,
983 boost::graph_traits<vtkGraph*>::edge_iterator>
986 typedef boost::graph_traits<vtkGraph*>::edge_iterator Iter;
990inline std::pair<boost::graph_traits<vtkGraph*>::out_edge_iterator,
991 boost::graph_traits<vtkGraph*>::out_edge_iterator>
994 typedef boost::graph_traits<vtkGraph*>::out_edge_iterator Iter;
995 std::pair<Iter, Iter> p = std::make_pair(Iter(g, u), Iter(g, u,
true));
999inline std::pair<boost::graph_traits<vtkGraph*>::in_edge_iterator,
1000 boost::graph_traits<vtkGraph*>::in_edge_iterator>
1003 typedef boost::graph_traits<vtkGraph*>::in_edge_iterator Iter;
1004 std::pair<Iter, Iter> p = std::make_pair(Iter(g, u), Iter(g, u,
true));
1008inline std::pair<boost::graph_traits<vtkGraph*>::adjacency_iterator,
1009 boost::graph_traits<vtkGraph*>::adjacency_iterator>
1012 typedef boost::graph_traits<vtkGraph*>::adjacency_iterator Iter;
1013 typedef boost::graph_traits<vtkGraph*>::out_edge_iterator OutEdgeIter;
1014 std::pair<OutEdgeIter, OutEdgeIter> out =
out_edges(u, g);
1015 return std::make_pair(Iter(out.first, &g), Iter(out.second, &g));
1028inline boost::graph_traits<vtkGraph*>::degree_size_type
out_degree(
1029 boost::graph_traits<vtkGraph*>::vertex_descriptor u,
vtkGraph* g)
1034inline boost::graph_traits<vtkDirectedGraph*>::degree_size_type
in_degree(
1035 boost::graph_traits<vtkDirectedGraph*>::vertex_descriptor u,
vtkDirectedGraph* g)
1040inline boost::graph_traits<vtkGraph*>::degree_size_type
degree(
1041 boost::graph_traits<vtkGraph*>::vertex_descriptor u,
vtkGraph* g)
1046inline boost::graph_traits<vtkMutableDirectedGraph*>::vertex_descriptor
add_vertex(
1052inline std::pair<boost::graph_traits<vtkMutableDirectedGraph*>::edge_descriptor,
bool>
add_edge(
1053 boost::graph_traits<vtkMutableDirectedGraph*>::vertex_descriptor u,
1056 boost::graph_traits<vtkMutableDirectedGraph*>::edge_descriptor e = g->
AddEdge(u, v);
1057 return std::make_pair(e,
true);
1060inline boost::graph_traits<vtkMutableUndirectedGraph*>::vertex_descriptor
add_vertex(
1066inline std::pair<boost::graph_traits<vtkMutableUndirectedGraph*>::edge_descriptor,
bool>
add_edge(
1067 boost::graph_traits<vtkMutableUndirectedGraph*>::vertex_descriptor u,
1068 boost::graph_traits<vtkMutableUndirectedGraph*>::vertex_descriptor v,
1071 boost::graph_traits<vtkMutableUndirectedGraph*>::edge_descriptor e = g->
AddEdge(u, v);
1072 return std::make_pair(e,
true);
1077VTK_ABI_NAMESPACE_BEGIN
1086VTK_ABI_NAMESPACE_END
1107VTK_ABI_NAMESPACE_BEGIN
1108template <
typename PMap>
1124VTK_ABI_NAMESPACE_END
1126template <
typename PMap>
1130 return get(helper.
pmap, key.Id);
1133template <
typename PMap>
1137 put(helper.
pmap, key.Id, value);
1144VTK_ABI_NAMESPACE_BEGIN
1145template <
typename PMap>
1161VTK_ABI_NAMESPACE_END
1163template <
typename PMap>
1170template <
typename PMap>
1181VTK_ABI_NAMESPACE_BEGIN
1185VTK_ABI_NAMESPACE_END
1205VTK_ABI_NAMESPACE_BEGIN
1206template <
typename PMap>
1222VTK_ABI_NAMESPACE_END
1224template <
typename PMap>
1231template <
typename PMap>
1249struct property_map<
vtkDirectedGraph*, vertex_index_t> : property_map<vtkGraph*, vertex_index_t>
1288 : property_map<vtkDirectedGraph*, vertex_index_t>
1294 : property_map<vtkUndirectedGraph*, vertex_index_t>
1300 : property_map<vtkDirectedGraph*, edge_index_t>
1306 : property_map<vtkUndirectedGraph*, edge_index_t>
1311#if BOOST_VERSION > 104000
1312#include <boost/property_map/vector_property_map.hpp>
1314#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.
abstract superclass for arrays of numeric data
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 vtkInformationIntegerKey * DATA_PIECE_NUMBER()
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.
virtual void GetOutEdges(vtkIdType v, vtkOutEdgeIterator *it)
Initializes the out edge iterator to iterate over all outgoing edges of vertex v.
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)