|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
76 template<
class NODELIST>
81 if (e->isSelfLoop()) {
82 L.pushBack(e->source());
142 template<
bool ONLY_ONCE = false>
144 if (G.numberOfEdges() <= 1) {
154 for (it = ++it; it.
valid(); ++it, ePrev = e) {
156 if (ePrev->isParallelDirected(e)) {
180 template<
class EDGELIST>
182 parallelEdges.clear();
183 if (G.numberOfEdges() <= 1) {
191 edge ePrev = *it++, e;
195 if (e->isParallelDirected(ePrev)) {
198 parallelEdges.pushBack(ePrev);
236 EdgeArray<int>& minIndex, EdgeArray<int>& maxIndex);
264 template<
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]) {
302 template<
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);
342 template<
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);
378 template<
class EDGELIST>
379 OGDF_DEPRECATED(
"The pointer-based makeParallelFreeUndirected() should be used instead.")
384 template<
class EDGELIST>
385 OGDF_DEPRECATED(
"The pointer-based makeParallelFreeUndirected() should be used instead.")
488 List<node>* isolated =
nullptr, ArrayBuffer<node>* reprs =
nullptr);
519 ArrayBuffer<Tuple2<node, node>>& addEdges,
bool onlyOne =
false);
587 int& nonEmptyComponents);
604 int doNotNeedTheValue;
923 return G.empty() || ((G.numberOfNodes() == G.numberOfEdges() + 1) &&
isConnected(G));
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
The namespace for all OGDF objects.
Declaration and implementation of ArrayBuffer class.
Includes declaration of graph class.
void removeSelfLoops(Graph &graph, node v)
Removes all self-loops for a given node v in graph.
#define OGDF_DEPRECATED(reason)
Mark a class / member / function as deprecated.
bool hasNonSelfLoopEdges(const Graph &G)
Returns whether G has edges which are not self-loops.
void degreeDistribution(const Graph &G, Array< int > °dist)
Fills degdist with the degree distribution of graph G.
Encapsulates a pointer to an ogdf::SList element.
void makeSimple(Graph &G)
Removes all self-loops and all but one edge of each bundle of parallel edges.
int connectedComponents(const Graph &G)
Computes the amount of connected components of G.
void makeLoopFree(Graph &G, NODELIST &L)
Removes all self-loops from G and returns all nodes with self-loops in L.
void makeLoopFree(Graph &G)
Removes all self-loops from G.
void getParallelFreeUndirected(const Graph &G, EdgeArray< EDGELIST > ¶llelEdges)
Computes the bundles of undirected 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 isConnected(const Graph &G)
Returns true iff G is connected.
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.
bool valid() const
Returns true iff the iterator points to an element.
bool isAcyclicUndirected(const Graph &G)
Returns true iff the undirected graph G is acyclic.
void safeForEach(CONTAINER &container, std::function< void(typename CONTAINER::value_type)> func)
Calls (possibly destructive) func for each element of container.
bool isForest(const Graph &G)
Returns true iff G is a forest consisting only of arborescences.
void parallelFreeSort(const Graph &G, SListPure< edge > &edges)
Sorts the edges of G such that parallel edges come after each other in the list.
bool isTriconnected(const Graph &G)
Returns true iff G is triconnected.
int numParallelEdgesUndirected(const Graph &G)
Returns the number of undirected parallel edges in G.
bool isAcyclic(const Graph &G)
Returns true iff the digraph G is acyclic.
iterator begin()
Returns an iterator to the first element of the list.
void makeAcyclic(Graph &G)
Makes the digraph G acyclic by removing edges.
bool findCutVertices(const Graph &G, ArrayBuffer< node > &cutVertices, bool onlyOne=false)
Finds cut vertices and potential edges that could be added to turn the cut vertices into non-cut vert...
EdgeElement * edge
The type of edges.
bool isTriconnectedPrimitive(const Graph &G)
Returns true iff G is triconnected (using a quadratic time algorithm!).
int numParallelEdges(const Graph &G)
Returns the number of parallel edges in G.
Implementation of algorithms as templates working with different list types.
int degree() const
Returns the degree of the node (indegree + outdegree).
bool isFreeForest(const Graph &G)
Returns true iff the undirected graph G is acyclic.
bool isStGraph(const Graph &G)
Returns true if G is an st-digraph.
Declaration of singly linked lists and iterators.
bool isTwoEdgeConnected(const Graph &graph)
Returns true iff graph is 2-edge-connected.
Decralation of GraphElement and GraphList classes.
void makeBiconnected(Graph &G)
Makes G biconnected by adding edges.
bool isArborescenceForest(const Graph &G)
Returns true iff G is a forest consisting only of arborescences.
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 makeParallelFree(Graph &G)
Removes all but one edge of each bundle of parallel edges in G.
node source() const
Returns the source node of the edge.
NodeElement * node
The type of nodes.
RegisteredArray for nodes, edges and adjEntries of a graph.
void makeBimodal(Graph &G)
Makes the digraph G bimodal.
Data type for general directed graphs (adjacency list representation).
bool isSimpleUndirected(const Graph &G)
Returns true iff G contains neither self-loops nor undirected parallel edges.
bool isRegular(const Graph &G, int d)
Checks if a graph is d-regular.
bool isLoopFree(const Graph &G)
Returns true iff G contains no self-loop.
int biconnectedComponents(const Graph &G, EdgeArray< int > &component)
Computes the biconnected components of G.
Decralation of graph iterators.
void triangulate(Graph &G)
Triangulates a planarly embedded graph G by adding edges.
int connectedIsolatedComponents(const Graph &G, List< node > &isolated, NodeArray< int > &component)
bool hasSingleSource(const Graph &G)
Returns true iff the digraph G contains exactly one source node (or is empty).
bool isParallelFreeUndirected(const Graph &G)
Returns true iff G contains no undirected parallel edges.
bool isBipartite(const Graph &G)
Checks whether a graph is bipartite.
bool isParallelFree(const Graph &G)
Returns true iff G contains no parallel edges.
Basic declarations, included by all source files.
bool isBiconnected(const Graph &G)
Returns true iff G is biconnected.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
bool hasSingleSink(const Graph &G)
Returns true iff the digraph G contains exactly one sink node (or is empty).
Declaration and implementation of Array class and Array algorithms.
Class for the representation of edges.
void topologicalNumbering(const Graph &G, NodeArray< int > &num)
Computes a topological numbering of an acyclic digraph G.
Declaration of doubly linked lists and iterators.
bool isArborescence(const Graph &G)
Returns true iff G represents an arborescence.
void makeParallelFreeUndirected(Graph &G, EDGELIST ¶llelEdges, EdgeArray< int > &cardPositive, EdgeArray< int > &cardNegative)
Class for the representation of nodes.
Declaration and implementation of class Tuple2, Tuple3 and Tuple4.
bool isSimple(const Graph &G)
Returns true iff G contains neither self-loops nor parallel edges.
void makeConnected(Graph &G)
makes G connected by adding a minimum number of edges.
bool isTree(const Graph &G)
Returns true iff G is a tree, i.e. contains no undirected cycle and is connected.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
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.