67 template<
class NODELIST>
73 if (e->isSelfLoop()) {
74 L.pushBack(e->source());
134 template <
bool ONLY_ONCE = false>
144 for(it = ++it; it.
valid(); ++it, ePrev = e) {
146 if (ePrev->isParallelDirected(e)) {
170 template <
class EDGELIST>
173 parallelEdges.clear();
180 edge ePrev = *it++, e;
184 if (e->isParallelDirected(ePrev)) {
186 if (bAppend) { parallelEdges.pushBack(ePrev); bAppend =
false; }
188 ePrev = e; bAppend =
true;
256 template <
bool ONLY_ONCE = false>
268 for(it = ++it; it.
valid(); ++it, ePrev = e) {
270 if (minIndex[ePrev] == minIndex[e] && maxIndex[ePrev] == maxIndex[e]) {
294 template <
class EDGELIST>
306 edge ePrev = *it++, e;
309 if (minIndex[ePrev] == minIndex[e] && maxIndex[ePrev] == maxIndex[e]) {
310 parallelEdges[ePrev].pushBack(e);
336 template <
class EDGELIST = SListPure<edge>>
339 EDGELIST *parallelEdges =
nullptr,
343 if (parallelEdges !=
nullptr) { parallelEdges->clear(); }
344 if (cardPositive !=
nullptr) { cardPositive->fill(0); }
345 if (cardNegative !=
nullptr) { cardNegative->fill(0); }
355 for (
edge parEdge : parEdges(e)) {
356 if (cardPositive !=
nullptr && e->
source() == parEdge->source()) {
357 (*cardPositive)[e]++;
359 if (cardNegative !=
nullptr && e->
source() == parEdge->target()) {
360 (*cardNegative)[e]++;
363 if (parallelEdges !=
nullptr) {
364 parallelEdges->pushBack(e);
374 template <
class EDGELIST>
375 OGDF_DEPRECATED(
"The pointer-based makeParallelFreeUndirected() should be used instead.")
383 template <
class EDGELIST>
384 OGDF_DEPRECATED(
"The pointer-based makeParallelFreeUndirected() should be used instead.")
386 EDGELIST ¶llelEdges,
579 int doNotNeedTheValue;
Declaration of singly linked lists and iterators.
bool hasNonSelfLoopEdges(const Graph &G)
Returns whether G has edges which are not self-loops.
void removeSelfLoops(Graph &graph, node v)
Removes all self-loops for a given node v in graph.
bool isForest(const Graph &G, List< node > &roots)
Returns true iff G is a forest consisting only of arborescences.
bool isRegular(const Graph &G)
Checks if a graph is regular.
bool valid() const
Returns true iff the iterator points to an element.
Data type for general directed graphs (adjacency list representation).
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
void makeLoopFree(Graph &G, NODELIST &L)
Removes all self-loops from G and returns all nodes with self-loops in L.
void topologicalNumbering(const Graph &G, NodeArray< int > &num)
Computes a topological numbering of an acyclic digraph G.
int degree() const
Returns the degree of the node (indegree + outdegree).
void getParallelFreeUndirected(const Graph &G, EdgeArray< EDGELIST > ¶llelEdges)
Computes the bundles of undirected parallel edges in G.
bool isTriconnectedPrimitive(const Graph &G, node &s1, node &s2)
Returns true iff G is triconnected (using a quadratic time algorithm!).
virtual void delEdge(edge e)
Removes edge e from the graph.
int numParallelEdgesUndirected(const Graph &G)
Returns the number of undirected parallel edges in G.
void makeSimple(Graph &G)
Removes all self-loops and all but one edge of each bundle of parallel edges.
Encapsulates a pointer to an ogdf::SList element.
int connectedIsolatedComponents(const Graph &G, List< node > &isolated, NodeArray< int > &component)
Computes the connected components of G and optionally generates a list of isolated nodes...
int connectedComponents(const Graph &G, NodeArray< int > &component, List< node > *isolated=nullptr)
Computes the connected components of G and optionally generates a list of isolated nodes...
void parallelFreeSort(const Graph &G, SListPure< edge > &edges)
Sorts the edges of G such that parallel edges come after each other in the list.
void makeSimpleUndirected(Graph &G)
Removes all self-loops and all but one edge of each bundle of undirected parallel edges...
int numParallelEdges(const Graph &G)
Returns the number of parallel edges in G.
void parallelFreeSortUndirected(const Graph &G, SListPure< edge > &edges, EdgeArray< int > &minIndex, EdgeArray< int > &maxIndex)
Sorts the edges of G such that undirected parallel edges come after each other in the list...
void makeConnected(Graph &G, List< edge > &added)
Makes G connected by adding a minimum number of edges.
bool isStGraph(const Graph &G, node &s, node &t, edge &st)
Returns true iff G is an st-digraph.
bool hasSingleSink(const Graph &G, node &sink)
Returns true iff the digraph G contains exactly one sink node (or is empty).
bool isTriconnected(const Graph &G, node &s1, node &s2)
Returns true iff G is triconnected.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
bool isFreeForest(const Graph &G)
Returns true iff the undirected graph G is acyclic.
int numberOfEdges() const
Returns the number of edges in the graph.
void nodeDistribution(const Graph &G, Array< int > °dist, std::function< int(node)> func)
Fills dist with the distribution given by a function func in graph G.
iterator begin()
Returns an iterator to the first element of the list.
bool isAcyclicUndirected(const Graph &G, List< edge > &backedges)
Returns true iff the undirected graph G is acyclic.
Declaration and implementation of EdgeArray class.
bool isArborescenceForest(const Graph &G, List< node > &roots)
Returns true iff G is a forest consisting only of arborescences.
bool isLoopFree(const Graph &G)
Returns true iff G contains no self-loop.
bool isBiconnected(const Graph &G, node &cutVertex)
Returns true iff G is biconnected.
Class for the representation of edges.
void makeBimodal(Graph &G, List< edge > &newEdges)
Makes the digraph G bimodal.
void makeAcyclicByReverse(Graph &G)
Makes the digraph G acyclic by reversing edges.
NodeElement * node
The type of nodes.
Class for the representation of nodes.
void makeAcyclic(Graph &G)
Makes the digraph G acyclic by removing edges.
Declaration and implementation of NodeArray class.
bool isAcyclic(const Graph &G, List< edge > &backedges)
Returns true iff the digraph G is acyclic.
void makeParallelFreeUndirected(Graph &G, EDGELIST *parallelEdges=nullptr, EdgeArray< int > *cardPositive=nullptr, EdgeArray< int > *cardNegative=nullptr)
Removes all but one edge of each bundle of undirected parallel edges.
bool isParallelFree(const Graph &G)
Returns true iff G contains no parallel edges.
bool isSimpleUndirected(const Graph &G)
Returns true iff G contains neither self-loops nor undirected parallel edges.
bool isArborescence(const Graph &G, node &root)
Returns true iff G represents an arborescence.
bool isParallelFreeUndirected(const Graph &G)
Returns true iff G contains no undirected parallel edges.
bool isTwoEdgeConnected(const Graph &graph, edge &bridge)
Returns true iff graph is 2-edge-connected.
bool hasSingleSource(const Graph &G, node &source)
Returns true iff the digraph G contains exactly one source node (or is empty).
void safeForEach(CONTAINER &container, std::function< void(typename CONTAINER::value_type)> func)
Calls (possibly destructive) func for each element of container.
bool isTree(const Graph &G)
Returns true iff G is a tree, i.e. contains no undirected cycle and is connected. ...
bool isBipartite(const Graph &G, NodeArray< bool > &color)
Checks whether a graph is bipartite.
#define OGDF_DEPRECATED(reason)
Mark a class / member / function as deprecated.
void degreeDistribution(const Graph &G, Array< int > °dist)
Fills degdist with the degree distribution of graph G.
node source() const
Returns the source node of the edge.
void triangulate(Graph &G)
Triangulates a planarly embedded graph G by adding edges.
int biconnectedComponents(const Graph &G, EdgeArray< int > &component, int &nonEmptyComponents)
Computes the biconnected components of G.
bool isSimple(const Graph &G)
Returns true iff G contains neither self-loops nor parallel edges.
The namespace for all OGDF objects.
int strongComponents(const Graph &G, NodeArray< int > &component)
Computes the strongly connected components of the digraph G.
int numberOfNodes() const
Returns the number of nodes in the graph.
void makeBiconnected(Graph &G, List< edge > &added)
Makes G biconnected by adding edges.
bool isConnected(const Graph &G)
Returns true iff G is connected.
void makeParallelFree(Graph &G, EDGELIST ¶llelEdges)
Removes all but one of each bundle of parallel edges.
bool empty() const
Returns true iff the graph is empty, i.e., contains no nodes.