43#include <initializer_list>
49class FilteringBFSIterator;
74 template<typename Container>
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) { }
108 node twin = adj->twinNode();
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;
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Declaration of singly linked lists and iterators.
Declaration and implementation of list-based queues (classes QueuePure<E> and Queue<E>).
Basic declarations, included by all source files.
Class for adjacency list elements.
An iterator-based BFS through a Graph.
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 >)
std::function< bool(node)> m_descend
FilteringBFSIterator begin()
bool hasVisited(node n) const
NodeArray< bool > m_visited
bool willDescendFrom(node n) const
void setVisitFilter(const std::function< bool(adjEntry)> &mVisit)
bool operator==(const FilteringBFS &rhs) const
bool willVisitTarget(adjEntry adj) const
FilteringBFSIterator end()
bool operator!=(const FilteringBFS &rhs) const
void setDescendFilter(const std::function< bool(node)> &mDescend)
std::function< bool(adjEntry)> m_visit
static bool return_true(T t)
FilteringBFSIterator & operator++()
std::input_iterator_tag iterator_category
std::ptrdiff_t difference_type
bool operator!=(const FilteringBFSIterator &rhs) const
bool operator==(const FilteringBFSIterator &rhs) const
FilteringBFSIterator(FilteringBFS *bfs)
Data type for general directed graphs (adjacency list representation).
Class for the representation of nodes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
The parameterized class Queue<E> implements list-based queues.
int size() const
Returns the number of elements in the queue.
E pop()
Removes front element and returns it.
bool empty() const
Returns true iff the queue is empty.
const_reference top() const
Returns a reference to the front element.
iterator append(const E &x)
Adds x at the end of queue.
const SList< E > & getList() const
Conversion to const SList.
RegisteredArray for nodes, edges and adjEntries of a graph.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Utility macros for declaring copy and move constructors and assignment operations.
#define OGDF_DEFAULT_MOVE(cls)
Explicitly provides default move construction and assignment for class cls.
#define OGDF_DEFAULT_COPY(cls)
Explicitly provides default copy construction and assignment for class cls.
Decralation of graph iterators.
NodeElement * node
The type of nodes.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
The namespace for all OGDF objects.
HypergraphRegistry< HypernodeElement >::iterator begin(const HypergraphRegistry< HypernodeElement > &self)
HypergraphRegistry< HypernodeElement >::iterator end(const HypergraphRegistry< HypernodeElement > &self)