|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
43 #include <initializer_list>
49 class FilteringBFSIterator;
74 template<
typename Container>
76 const std::function<
bool(
adjEntry)>& visit = return_true<adjEntry>,
77 const std::function<
bool(
node)>& descend_from = return_true<node>)
78 : m_pending(), m_visited(G, false), m_visit(visit), m_descend(descend_from) {
79 for (
node n : nodes) {
85 const std::function<
bool(
adjEntry)>& visit = return_true<adjEntry>,
86 const std::function<
bool(
node)>& descend_from = return_true<node>)
87 : m_pending(nodes), m_visited(G, false), m_visit(visit), m_descend(descend_from) { }
107 for (
adjEntry adj : n->adjEntries) {
109 if (!m_visited[twin] && m_visit(adj)) {
114 while (!m_pending.
empty() && m_visited[m_pending.
top()]) {
121 return m_pending.
top();
124 operator bool()
const {
return valid(); }
129 m_visited[n] =
false;
The namespace for all OGDF objects.
bool hasVisited(node n) const
FilteringBFSIterator & operator++()
iterator append(const E &x)
Adds x at the end of queue.
Includes declaration of graph class.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
FilteringBFSIterator(FilteringBFS *bfs)
Utility macros for declaring copy and move constructors and assignment operations.
An iterator-based BFS through a Graph.
HypergraphRegistry< HypernodeElement >::iterator begin(const HypergraphRegistry< HypernodeElement > &self)
#define OGDF_DEFAULT_MOVE(cls)
Explicitly provides default move construction and assignment for class cls.
bool willVisitTarget(adjEntry adj) const
bool willDescendFrom(node n) const
const_reference top() const
Returns a reference to the front element.
Declaration and implementation of list-based queues (classes QueuePure<E> and Queue<E>).
bool operator!=(const FilteringBFS &rhs) const
Class for adjacency list elements.
FilteringBFSIterator begin()
FilteringBFSIterator end()
std::function< bool(node)> m_descend
void setVisitFilter(const std::function< bool(adjEntry)> &mVisit)
FilteringBFS(const Graph &G, Container &nodes, const std::function< bool(adjEntry)> &visit=return_true< adjEntry >, const std::function< bool(node)> &descend_from=return_true< node >)
bool operator==(const FilteringBFS &rhs) const
E pop()
Removes front element and returns it.
bool operator==(const FilteringBFSIterator &rhs) const
Declaration of singly linked lists and iterators.
int size() const
Returns the number of elements in the queue.
Decralation of GraphElement and GraphList classes.
FilteringBFS(const Graph &G, std::initializer_list< node > nodes, const std::function< bool(adjEntry)> &visit=return_true< adjEntry >, const std::function< bool(node)> &descend_from=return_true< node >)
NodeElement * node
The type of nodes.
std::input_iterator_tag iterator_category
RegisteredArray for nodes, edges and adjEntries of a graph.
The parameterized class Queue<E> implements list-based queues.
Data type for general directed graphs (adjacency list representation).
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Decralation of graph iterators.
bool empty() const
Returns true iff the queue is empty.
Basic declarations, included by all source files.
HypergraphRegistry< HypernodeElement >::iterator end(const HypergraphRegistry< HypernodeElement > &self)
NodeArray< bool > m_visited
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
static bool return_true(T t)
void setDescendFilter(const std::function< bool(node)> &mDescend)
bool operator!=(const FilteringBFSIterator &rhs) const
#define OGDF_DEFAULT_COPY(cls)
Explicitly provides default copy construction and assignment for class cls.
std::ptrdiff_t difference_type
Class for the representation of nodes.
const SList< E > & getList() const
Conversion to const SList.
std::function< bool(adjEntry)> m_visit