Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
GraphSets.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Graph.h>
35#include <ogdf/basic/GraphList.h> // IWYU pragma: keep
37#include <ogdf/basic/basic.h>
39
40#include <iterator>
41#include <utility>
42
43namespace ogdf {
44
46
54class OGDF_EXPORT NodeSet : public RegisteredSet<internal::GraphNodeRegistry> {
55public:
57 explicit NodeSet(const Graph& graph)
58 : RegisteredSet((const internal::GraphNodeRegistry&)graph) { }
59
60 using RegisteredSet::RegisteredSet;
62
64 const list_type& nodes() { return elements(); }
65
67 const Graph& graphOf() const {
68 OGDF_ASSERT(registeredAt());
69 return *registeredAt()->graphOf();
70 }
71};
72
74
86class OGDF_EXPORT EdgeSet : public RegisteredSet<internal::GraphEdgeRegistry> {
87public:
89 explicit EdgeSet(const Graph& graph)
90 : RegisteredSet((const internal::GraphEdgeRegistry&)graph) { }
91
92 using RegisteredSet::RegisteredSet;
94
96 const list_type& edges() { return elements(); }
97
99 const Graph& graphOf() const {
100 OGDF_ASSERT(RegisteredSet::registeredAt());
101 return *registeredAt()->graphOf();
102 }
103};
104
106
114class OGDF_EXPORT AdjEntrySet : public RegisteredSet<internal::GraphAdjRegistry> {
115public:
117 explicit AdjEntrySet(const Graph& graph)
118 : RegisteredSet((const internal::GraphAdjRegistry&)graph) { }
119
120 using RegisteredSet::RegisteredSet;
122
124 const list_type& adjEntries() { return elements(); }
125
127 const Graph& graphOf() const {
128 OGDF_ASSERT(RegisteredSet::registeredAt());
129 return *registeredAt()->graphOf();
130 }
131};
132
133template<OGDF_NODE_LIST NL>
134std::pair<int, int> Graph::insert(const NL& nodeList, const EdgeSet& edgeSet,
135 NodeArray<node>& nodeMap, EdgeArray<edge>& edgeMap) {
136 using std::size;
137 m_regNodeArrays.reserveSpace(size(nodeList));
138 m_regEdgeArrays.reserveSpace(size(edgeSet));
139 m_regAdjArrays.reserveSpace(size(edgeSet));
140 using std::begin;
141 using std::end;
142 return insert(begin(nodeList), end(nodeList), edgeSet, nodeMap, edgeMap);
143}
144
145}
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Declaration and implementation of ogdf::RegisteredSet.
Basic declarations, included by all source files.
AdjEntry sets.
Definition GraphSets.h:114
const list_type & adjEntries()
Returns a reference to the list of adjEntries contained in this set.
Definition GraphSets.h:124
const Graph & graphOf() const
Returns the associated graph.
Definition GraphSets.h:127
AdjEntrySet(const Graph &graph)
Creates a new adjEntry set associated with graph.
Definition GraphSets.h:117
Edge sets.
Definition GraphSets.h:86
const list_type & edges()
Returns a reference to the list of edges contained in this set.
Definition GraphSets.h:96
const Graph & graphOf() const
Returns the associated graph.
Definition GraphSets.h:99
EdgeSet(const Graph &graph)
Creates a new edge set associated with graph.
Definition GraphSets.h:89
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
internal::GraphEdgeRegistry m_regEdgeArrays
The registered edge arrays.
Definition Graph_d.h:878
internal::GraphAdjRegistry m_regAdjArrays
The registered adjEntry arrays.
Definition Graph_d.h:879
internal::GraphNodeRegistry m_regNodeArrays
The registered node arrays.
Definition Graph_d.h:877
std::pair< int, int > insert(const NI &nodesBegin, const NI &nodesEnd, const EI &edgesBegin, const EI &edgesEnd, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
Inserts a copy of a given subgraph into this graph.
Node sets.
Definition GraphSets.h:54
const Graph & graphOf() const
Returns the associated graph.
Definition GraphSets.h:67
const list_type & nodes()
Returns a reference to the list of nodes contained in this set.
Definition GraphSets.h:64
NodeSet(const Graph &graph)
Creates a new node set associated with graph.
Definition GraphSets.h:57
Constant-time set operations.
void reserveSpace(int new_keys)
Resizes all arrays to make space of new_keys new keys.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
Utility macros for declaring copy and move constructors and assignment operations.
#define OGDF_DEFAULT_COPY(cls)
Explicitly provides default copy construction and assignment for class cls.
Definition copy_move.h:47
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:52
The namespace for all OGDF objects.
HypergraphRegistry< HypernodeElement >::iterator begin(const HypergraphRegistry< HypernodeElement > &self)
HypergraphRegistry< HypernodeElement >::iterator end(const HypergraphRegistry< HypernodeElement > &self)