Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ogdf_iterator.h
Go to the documentation of this file.
1
31#pragma once
32
33#include <ogdf/basic/Graph_d.h>
34
35namespace ogdf {
36namespace internal {
37namespace gcm {
38namespace graph {
39
42template<typename _Entry>
44public:
45 using Entry = _Entry;
47
48protected:
50
51public:
53 //nothing to do
54 }
55
57 m_cur = m_cur->pred();
58 return *this;
59 }
60
62 m_cur = m_cur->succ();
63 return *this;
64 }
65
66 bool operator==(const Iterator& b) const { return m_cur == b.m_cur; }
67
68 bool operator!=(const Iterator& b) const { return m_cur != b.m_cur; }
69};
70
71template<typename Entry>
72class EntryIterator : public OGDFEntryIterator<Entry> {
73private:
75
76public:
77 using T = Entry;
78 using parent::parent;
79
80 Entry operator*() { return this->m_cur; }
81};
82
84class IncidentEdgeIterator : public OGDFEntryIterator<adjEntry> {
85private:
87
88public:
89 using T = edge;
90 using parent::parent;
91
92 edge operator*() { return this->m_cur->theEdge(); }
93};
94
95/* Iterate over adjacent nodes
96 */
97class AdjacentNodeIterator : public OGDFEntryIterator<adjEntry> {
98private:
100
101public:
102 using T = node;
103 using parent::parent;
104
105 node operator*() { return this->m_cur->twin()->theNode(); }
106};
107
111
112
113}
114}
115}
116}
Pure declaration header, find template implementation in Graph.h.
adjEntry twin() const
Returns the corresponding adjacency element associated with the same edge.
Definition Graph_d.h:109
edge theEdge() const
Returns the edge associated with this adjacency entry.
Definition Graph_d.h:97
node theNode() const
Returns the node whose adjacency list contains this element.
Definition Graph_d.h:103
Class for the representation of edges.
Definition Graph_d.h:300
Class for the representation of nodes.
Definition Graph_d.h:177
Entry operator*()
Entry T
iterate over entries of an ogdf graph
Iterator & operator--()
Iterator & operator++()
_Entry Entry
OGDFEntryIterator(Entry _cur)
bool operator==(const Iterator &b) const
Entry m_cur
bool operator!=(const Iterator &b) const
NodeElement * node
The type of nodes.
Definition Graph_d.h:64
EdgeElement * edge
The type of edges.
Definition Graph_d.h:68
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.