 |
Open Graph Drawing Framework |
v. 2022.02 (Dogwood)
|
|
|
Go to the documentation of this file.
68 template<
class NODELIST>
74 if (e->isSelfLoop()) {
75 L.pushBack(e->source());
136 template <
bool ONLY_ONCE = false>
138 if (G.numberOfEdges() <= 1)
return 0;
146 for(it = ++it; it.
valid(); ++it, ePrev = e) {
148 if (ePrev->isParallelDirected(e)) {
172 template <
class EDGELIST>
175 parallelEdges.clear();
176 if (G.numberOfEdges() <= 1)
return;
182 edge ePrev = *it++, e;
186 if (e->isParallelDirected(ePrev)) {
188 if (bAppend) { parallelEdges.pushBack(ePrev); bAppend =
false; }
190 ePrev = e; bAppend =
true;
227 SListPure<edge> &edges,
228 EdgeArray<int> &minIndex,
229 EdgeArray<int> &maxIndex);
258 template <
bool ONLY_ONCE = false>
261 if (G.numberOfEdges() <= 1)
return 0;
270 for(it = ++it; it.
valid(); ++it, ePrev = e) {
272 if (minIndex[ePrev] == minIndex[e] && maxIndex[ePrev] == maxIndex[e]) {
296 template <
class EDGELIST>
299 if (G.numberOfEdges() <= 1) {
308 edge ePrev = *it++, e;
311 if (minIndex[ePrev] == minIndex[e] && maxIndex[ePrev] == maxIndex[e]) {
312 parallelEdges[ePrev].pushBack(e);
338 template <
class EDGELIST = SListPure<edge>>
341 EDGELIST *parallelEdges =
nullptr,
345 if (parallelEdges !=
nullptr) { parallelEdges->clear(); }
346 if (cardPositive !=
nullptr) { cardPositive->fill(0); }
347 if (cardNegative !=
nullptr) { cardNegative->fill(0); }
349 if (G.numberOfEdges() <= 1) {
356 for (
edge e : G.edges) {
357 for (
edge parEdge : parEdges(e)) {
358 if (cardPositive !=
nullptr && e->
source() == parEdge->source()) {
359 (*cardPositive)[e]++;
361 if (cardNegative !=
nullptr && e->
source() == parEdge->target()) {
362 (*cardNegative)[e]++;
365 if (parallelEdges !=
nullptr) {
366 parallelEdges->pushBack(e);
373 template <
class EDGELIST>
374 OGDF_DEPRECATED(
"The pointer-based makeParallelFreeUndirected() should be used instead.")
379 template <
class EDGELIST>
380 OGDF_DEPRECATED(
"The pointer-based makeParallelFreeUndirected() should be used instead.")
382 EDGELIST ¶llelEdges,
491 NodeArray<int> &component,
492 List<node> *isolated =
nullptr);
525 ArrayBuffer<node> &cutVertices,
526 ArrayBuffer<Tuple2<node,node>> &addEdges,
527 bool onlyOne =
false);
545 bool onlyOne =
false) {
619 int doNotNeedTheValue;
958 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.
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.
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.
Declaration and implementation of EdgeArray class.
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.
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.
Declaration and implementation of NodeArray class.
void triangulate(Graph &G)
Triangulates a planarly embedded graph G by adding edges.
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.
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.
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).
Class for the representation of edges.
void topologicalNumbering(const Graph &G, NodeArray< int > &num)
Computes a topological numbering of an acyclic digraph G.
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.
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.