76template<
class NODELIST>
81 if (e->isSelfLoop()) {
82 L.pushBack(e->source());
142template<
bool ONLY_ONCE = false>
144 if (G.numberOfEdges() <= 1) {
154 for (it = ++it; it.
valid(); ++it, ePrev = e) {
180template<
class EDGELIST>
182 parallelEdges.clear();
183 if (G.numberOfEdges() <= 1) {
191 edge ePrev = *it++, e;
195 if (e->isParallelDirected(ePrev)) {
198 parallelEdges.pushBack(ePrev);
264template<
bool ONLY_ONCE = false>
266 if (G.numberOfEdges() <= 1) {
277 for (it = ++it; it.
valid(); ++it, ePrev = e) {
279 if (minIndex[ePrev] == minIndex[e] && maxIndex[ePrev] == maxIndex[e]) {
302template<
class EDGELIST>
304 if (G.numberOfEdges() <= 1) {
313 edge ePrev = *it++, e;
316 if (minIndex[ePrev] == minIndex[e] && maxIndex[ePrev] == maxIndex[e]) {
317 parallelEdges[ePrev].pushBack(e);
342template<
class EDGELIST = SListPure<edge>>
345 if (parallelEdges !=
nullptr) {
346 parallelEdges->clear();
348 if (cardPositive !=
nullptr) {
349 cardPositive->fill(0);
351 if (cardNegative !=
nullptr) {
352 cardNegative->fill(0);
355 if (G.numberOfEdges() <= 1) {
362 for (
edge e : G.edges) {
363 for (
edge parEdge : parEdges(e)) {
364 if (cardPositive !=
nullptr && e->source() == parEdge->source()) {
365 (*cardPositive)[e]++;
367 if (cardNegative !=
nullptr && e->source() == parEdge->target()) {
368 (*cardNegative)[e]++;
371 if (parallelEdges !=
nullptr) {
372 parallelEdges->pushBack(e);
378template<
class EDGELIST>
379OGDF_DEPRECATED(
"The pointer-based makeParallelFreeUndirected() should be used instead.")
380void makeParallelFreeUndirected(
Graph& G, EDGELIST& parallelEdges) {
384template<
class EDGELIST>
385OGDF_DEPRECATED(
"The pointer-based makeParallelFreeUndirected() should be used instead.")
386void makeParallelFreeUndirected(
Graph& G, EDGELIST& parallelEdges,
EdgeArray<
int>& cardPositive,
587 int& nonEmptyComponents);
604 int doNotNeedTheValue;
923 return G.empty() || ((G.numberOfNodes() == G.numberOfEdges() + 1) &&
isConnected(G));
Declaration and implementation of Array class and Array algorithms.
Declaration and implementation of ArrayBuffer class.
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Declaration of doubly linked lists and iterators.
Declaration of singly linked lists and iterators.
Basic declarations, included by all source files.
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
The parameterized class Array implements dynamic arrays of type E.
Class for the representation of edges.
bool isParallelDirected(edge e) const
Returns true iff edge e is parallel to this (directed) edge (or if it is the same edge)
Data type for general directed graphs (adjacency list representation).
Doubly linked lists (maintaining the length of the list).
Class for the representation of nodes.
int degree() const
Returns the degree of the node (indegree + outdegree).
Encapsulates a pointer to an ogdf::SList element.
bool valid() const
Returns true iff the iterator points to an element.
iterator begin()
Returns an iterator to the first element of the list.
Tuples of two elements (2-tuples).
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
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),...
Decralation of graph iterators.
int connectedComponents(const Graph &G, NodeArray< int > &component, List< node > *isolated=nullptr, ArrayBuffer< node > *reprs=nullptr)
Computes the connected components of G and optionally generates a list of isolated nodes.
bool isBiconnected(const Graph &G, node &cutVertex)
Returns true iff G is biconnected.
void makeBiconnected(Graph &G, List< edge > &added)
Makes G biconnected by adding edges.
void makeConnected(Graph &G, List< edge > &added)
Makes G connected by adding a minimum number of edges.
int biconnectedComponents(const Graph &G, EdgeArray< int > &component, int &nonEmptyComponents)
Computes the biconnected components of G.
bool isConnected(const Graph &G)
Returns true iff G is connected.
bool isTwoEdgeConnected(const Graph &graph, edge &bridge)
Returns true iff graph is 2-edge-connected.
bool isTriconnected(const Graph &G, node &s1, node &s2)
Returns true iff G is triconnected.
bool findCutVertices(const Graph &G, ArrayBuffer< node > &cutVertices, ArrayBuffer< Tuple2< node, node > > &addEdges, bool onlyOne=false)
Finds cut vertices and potential edges that could be added to turn the cut vertices into non-cut vert...
void triangulate(Graph &G)
Triangulates a planarly embedded graph G by adding edges.
bool isTriconnectedPrimitive(const Graph &G, node &s1, node &s2)
Returns true iff G is triconnected (using a quadratic time algorithm!).
bool isAcyclic(const Graph &G, List< edge > &backedges)
Returns true iff the digraph G is acyclic.
int strongComponents(const Graph &G, NodeArray< int > &component)
Computes the strongly connected components of the digraph G.
void makeAcyclicByReverse(Graph &G)
Makes the digraph G acyclic by reversing edges.
void makeBimodal(Graph &G, List< edge > &newEdges)
Makes the digraph G bimodal.
bool hasSingleSource(const Graph &G, node &source)
Returns true iff the digraph G contains exactly one source node (or is empty).
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).
void makeAcyclic(Graph &G)
Makes the digraph G acyclic by removing edges.
void topologicalNumbering(const Graph &G, NodeArray< int > &num)
Computes a topological numbering of an acyclic digraph G.
bool isAcyclicUndirected(const Graph &G, List< edge > &backedges)
Returns true iff the undirected graph G is acyclic.
bool isParallelFreeUndirected(const Graph &G)
Returns true iff G contains no undirected parallel edges.
void makeLoopFree(Graph &G, NODELIST &L)
Removes all self-loops from G and returns all nodes with self-loops in L.
bool isParallelFree(const Graph &G)
Returns true iff G contains no parallel edges.
void makeSimple(Graph &G)
Removes all self-loops and all but one edge of each bundle of parallel edges.
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 isLoopFree(const Graph &G)
Returns true iff G contains no self-loop.
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 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.
int numParallelEdgesUndirected(const Graph &G)
Returns the number of undirected parallel edges in G.
void makeParallelFree(Graph &G, EDGELIST ¶llelEdges)
Removes all but one of each bundle of parallel edges.
void removeSelfLoops(Graph &graph, node v)
Removes all self-loops for a given node v in graph.
void getParallelFreeUndirected(const Graph &G, EdgeArray< EDGELIST > ¶llelEdges)
Computes the bundles of undirected parallel edges in G.
bool isSimpleUndirected(const Graph &G)
Returns true iff G contains neither self-loops nor undirected parallel edges.
bool isSimple(const Graph &G)
Returns true iff G contains neither self-loops nor parallel edges.
bool hasNonSelfLoopEdges(const Graph &G)
Returns whether G has edges which are not self-loops.
int numParallelEdges(const Graph &G)
Returns the number of parallel edges in G.
void makeSimpleUndirected(Graph &G)
Removes all self-loops and all but one edge of each bundle of undirected parallel edges.
bool isArborescenceForest(const Graph &G, List< node > &roots)
Returns true iff G is a forest consisting only of arborescences.
bool isArborescence(const Graph &G, node &root)
Returns true iff G represents an arborescence.
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.
void degreeDistribution(const Graph &G, Array< int > °dist)
Fills degdist with the degree distribution of graph G.
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.
bool isRegular(const Graph &G)
Checks if a graph is regular.
#define OGDF_DEPRECATED(reason)
Mark a class / member / function as deprecated.
Implementation of algorithms as templates working with different list types.
The namespace for all OGDF objects.
void safeForEach(CONTAINER &container, std::function< void(typename CONTAINER::value_type)> func)
Calls (possibly destructive) func for each element of container.
Declaration and implementation of class Tuple2, Tuple3 and Tuple4.