Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::Graph Class Reference

Data type for general directed graphs (adjacency list representation). More...

#include <ogdf/basic/Graph_d.h>

+ Inheritance diagram for ogdf::Graph:

Classes

class  CCsInfo
 Info structure for maintaining connected components. More...
 
class  HiddenEdgeSet
 Functionality for temporarily hiding edges in constant time. More...
 

Public Types

Enumerations

These enumerations are mainly meant for advanced or internal usage scenarios.

enum  EdgeType { EdgeType::association = 0, EdgeType::generalization = 1, EdgeType::dependency = 2 }
 The type of edges (only used in derived classes). More...
 
enum  NodeType { NodeType::vertex = 0, NodeType::dummy = 1, NodeType::generalizationMerger = 2, NodeType::generalizationExpander = 3, NodeType::highDegreeExpander = 4, NodeType::lowDegreeExpander = 5, NodeType::associationClass = 6 }
 The type of nodes. More...
 
Iterators

These types are used for graph object iterators, which are returned by graph object containers like nodes and edges.

using node_iterator = internal::GraphIterator< node >
 Provides a bidirectional iterator to a node in a graph. More...
 
using edge_iterator = internal::GraphIterator< edge >
 Provides a bidirectional iterator to an edge in a graph. More...
 
using adjEntry_iterator = internal::GraphIterator< adjEntry >
 Provides a bidirectional iterator to an entry in an adjacency list. More...
 

Public Member Functions

 Graph ()
 Constructs an empty graph. More...
 
 Graph (const Graph &copy)
 Constructs a graph that is a copy of G. More...
 
 Graph (Graph &&move)=delete
 
virtual ~Graph ()
 Destructor. More...
 
Graphoperator= (const Graph &copy)
 Overwrites this graph to be a copy of G. More...
 
Graphoperator= (Graph &&move)=delete
 
Access methods
bool empty () const
 Returns true iff the graph is empty, i.e., contains no nodes. More...
 
int numberOfNodes () const
 Returns the number of nodes in the graph. More...
 
int numberOfEdges () const
 Returns the number of edges in the graph. More...
 
int maxNodeIndex () const
 Returns the largest used node index. More...
 
int maxEdgeIndex () const
 Returns the largest used edge index. More...
 
int maxAdjEntryIndex () const
 Returns the largest used adjEntry index. More...
 
node firstNode () const
 Returns the first node in the list of all nodes. More...
 
node lastNode () const
 Returns the last node in the list of all nodes. More...
 
edge firstEdge () const
 Returns the first edge in the list of all edges. More...
 
edge lastEdge () const
 Returns the last edge in the list of all edges. More...
 
node chooseNode (std::function< bool(node)> includeNode=[](node) { return true;}, bool isFastTest=true) const
 Returns a random node. More...
 
edge chooseEdge (std::function< bool(edge)> includeEdge=[](edge) { return true;}, bool isFastTest=true) const
 Returns a random edge. More...
 
template<class CONTAINER >
void allNodes (CONTAINER &nodeContainer) const
 Returns a container with all nodes of the graph. More...
 
template<class CONTAINER >
void allEdges (CONTAINER &edgeContainer) const
 Returns a container with all edges of the graph. More...
 
Creation of new nodes and edges
node newNode (int index=-1)
 Creates a new node and returns it. More...
 
edge newEdge (node v, node w, int index=-1)
 Creates a new edge (v,w) and returns it. More...
 
edge newEdge (node v, adjEntry adjTgt, int index=-1)
 Creates a new edge at predefined positions in the adjacency lists. More...
 
edge newEdge (adjEntry adjSrc, node w, int index=-1)
 Creates a new edge at predefined positions in the adjacency lists. More...
 
edge newEdge (adjEntry adjSrc, adjEntry adjTgt, Direction dir=Direction::after, int index=-1)
 Creates a new edge at predefined positions in the adjacency lists. More...
 
template<typename S , typename T >
edge newEdge (S src, Direction dirSrc, T tgt, Direction dirTgt, int index=-1)
 Creates a new edge at predefined positions in the adjacency lists. More...
 
Removing nodes and edges
virtual void delNode (node v)
 Removes node v and all incident edges from the graph. More...
 
virtual void delEdge (edge e)
 Removes edge e from the graph. More...
 
virtual void clear ()
 Removes all nodes and all edges from the graph. More...
 
void restoreAllEdges ()
 Restore all hidden edges and invalidate all HiddenEdgeSets. More...
 
Advanced modification methods
virtual edge split (edge e)
 Splits edge e into two edges introducing a new node. More...
 
void unsplit (node u)
 Undoes a split operation. More...
 
virtual void unsplit (edge eIn, edge eOut)
 Undoes a split operation. More...
 
node splitNode (adjEntry adjStartLeft, adjEntry adjStartRight)
 Splits a node while preserving the order of adjacency entries. More...
 
node contract (edge e, bool keepSelfLoops=false)
 Contracts edge e while preserving the order of adjacency entries. More...
 
void move (edge e, adjEntry adjSrc, Direction dirSrc, adjEntry adjTgt, Direction dirTgt)
 Moves edge e to a different adjacency list. More...
 
void moveTarget (edge e, node w)
 Moves the target node of edge e to node w. More...
 
void moveTarget (edge e, adjEntry adjTgt, Direction dir)
 Moves the target node of edge e to a specific position in an adjacency list. More...
 
void moveSource (edge e, node w)
 Moves the source node of edge e to node w. More...
 
void moveSource (edge e, adjEntry adjSrc, Direction dir)
 Moves the source node of edge e to a specific position in an adjacency list. More...
 
edge searchEdge (node v, node w, bool directed=false) const
 Searches and returns an edge connecting nodes v and w in time O( min(deg(v ), deg(w ))). More...
 
void reverseEdge (edge e)
 Reverses the edge e, i.e., exchanges source and target node. More...
 
void reverseAllEdges ()
 Reverses all edges in the graph. More...
 
template<class NODELIST >
void collapse (NODELIST &nodesToCollapse)
 Collapses all nodes in the list nodesToCollapse to the first node in the list. More...
 
template<class ADJ_ENTRY_LIST >
void sort (node v, const ADJ_ENTRY_LIST &newOrder)
 Sorts the adjacency list of node v according to newOrder. More...
 
template<class IT >
void sort (node v, IT begin, IT end)
 Sorts the adjacency list of node v according to the range denoted by two iterators. More...
 
void reverseAdjEdges (node v)
 Reverses the adjacency list of v. More...
 
void moveAdj (adjEntry adjMove, Direction dir, adjEntry adjPos)
 Moves adjacency entry adjMove before or after adjPos. More...
 
void moveAdjAfter (adjEntry adjMove, adjEntry adjAfter)
 Moves adjacency entry adjMove after adjAfter. More...
 
void moveAdjBefore (adjEntry adjMove, adjEntry adjBefore)
 Moves adjacency entry adjMove before adjBefore. More...
 
void reverseAdjEdges ()
 Reverses all adjacency lists. More...
 
void swapAdjEdges (adjEntry adj1, adjEntry adj2)
 Exchanges two entries in an adjacency list. More...
 
Miscellaneous
int genus () const
 Returns the genus of the graph's embedding. More...
 
bool representsCombEmbedding () const
 Returns true iff the graph represents a combinatorial embedding. More...
 
void consistencyCheck () const
 Asserts that this graph is consistent. More...
 
Registering arrays and observers

These methods are used by various graph array types like NodeArray or EdgeArray.

There should be no need to use them directly in user code.

internal::GraphNodeRegistrynodeRegistry ()
 Returns a reference to the registry of node arrays associated with this graph. More...
 
const internal::GraphNodeRegistrynodeRegistry () const
 Returns a const reference to the registry of node arrays associated with this graph. More...
 
 operator const internal::GraphNodeRegistry & () const
 
internal::GraphEdgeRegistryedgeRegistry ()
 Returns a reference to the registry of edge arrays associated with this graph. More...
 
const internal::GraphEdgeRegistryedgeRegistry () const
 Returns a const reference to the registry of edge arrays associated with this graph. More...
 
 operator const internal::GraphEdgeRegistry & () const
 
internal::GraphAdjRegistryadjEntryRegistry ()
 Returns a reference to the registry of adjEntry arrays associated with this graph. More...
 
const internal::GraphAdjRegistryadjEntryRegistry () const
 Returns a const reference to the registry of adjEntry arrays associated with this graph. More...
 
 operator const internal::GraphAdjRegistry & () const
 
void resetEdgeIdCount (int maxId)
 Resets the edge id count to maxId. More...
 
void resetNodeIdCount (int maxId)
 
- Public Member Functions inherited from ogdf::Observable< GraphObserver, Graph >
 Observable ()=default
 
 Observable (const Observable &copy)=delete
 If you want to copy a subclass of Observable, call the default Observable() constructor. More...
 
 Observable (Observable &&move)=delete
 If you want to move a subclass of Observable, call the default Observable() constructor. More...
 
virtual ~Observable ()
 
Observableoperator= (const Observable &copy)=delete
 
Observableoperator= (Observable &&move)=delete
 

Public Attributes

Graph object containers

These containers maintain the nodes and edges of the graph, and provide node and edge iterators.

internal::GraphObjectContainer< NodeElementnodes
 The container containing all node objects. More...
 
internal::GraphObjectContainer< EdgeElementedges
 The container containing all edge objects. More...
 

Private Member Functions

void moveAdj (adjEntry adj, node w)
 moves adjacency entry to node w More...
 
edge pureNewEdge (node src, node tgt, int index)
 Creates a new edge object with id index and corresponding AdjElements and adds it to the list of edges. More...
 
node pureNewNode (int index)
 Creates a new node object with id index and adds it to the list of nodes. More...
 

Static Private Member Functions

static void insertAdjEntry (adjEntry oldAdj, adjEntry newAdj, Direction dir)
 
static void insertAdjEntry (node n, adjEntry newAdj, Direction dir)
 

Private Attributes

int m_edgeIdCount
 The Index that will be assigned to the next created edge. More...
 
List< HiddenEdgeSet * > m_hiddenEdgeSets
 The list of hidden edges. More...
 
int m_nodeIdCount
 The Index that will be assigned to the next created node. More...
 
internal::GraphAdjRegistry m_regAdjArrays
 The registered adjEntry arrays. More...
 
internal::GraphEdgeRegistry m_regEdgeArrays
 The registered edge arrays. More...
 
internal::GraphNodeRegistry m_regNodeArrays
 The registered node arrays. More...
 

Friends

class GraphObserver
 

Subgraph insertion

template<OGDF_NODE_ITER NI, OGDF_EDGE_ITER EI, bool copyEmbedding = true, bool copyIDs = false, bool notifyObservers = true>
std::pair< int, int > insert (const NI &nodesBegin, const NI &nodesEnd, const EI &edgesBegin, const EI &edgesEnd, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
 Inserts a copy of a given subgraph into this graph. More...
 
template<OGDF_NODE_ITER NI, OGDF_EDGE_FILTER EF, bool copyIDs = false, bool notifyObservers = true>
std::pair< int, int > insert (const NI &nodesBegin, const NI &nodesEnd, const EF &edgeFilter, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
 Inserts a copy of a given subgraph into this graph. More...
 
template<OGDF_NODE_LIST NL>
std::pair< int, int > insert (const NL &nodeList, const EdgeSet< true > &edgeSet, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
 Inserts a copy of a given subgraph into this graph. More...
 
template<OGDF_NODE_LIST NL>
std::pair< int, int > insert (const NL &nodeList, const EdgeSet< false > &edgeSet, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
 Inserts a copy of a given subgraph into this graph. More...
 
template<OGDF_NODE_LIST NL, OGDF_EDGE_LIST EL>
std::pair< int, int > insert (const NL &nodeList, const EL &edgeList, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
 Inserts a copy of a given subgraph into this graph. More...
 
std::pair< int, int > insert (const CCsInfo &info, int cc, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
 Inserts a copy of a given connected component cc into this graph. More...
 
std::pair< int, int > insert (const Graph &G, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
 Inserts a copy of a given Graph G into this graph. More...
 
std::pair< int, int > insert (const Graph &G)
 Inserts a copy of a given Graph G into this graph. More...
 
template<OGDF_NODE_ITER NI, bool notifyObservers, bool copyIDs>
void insertNodes (const NI &nodesBegin, const NI &nodesEnd, NodeArray< node, true > &nodeMap, int &newNodes, void *cbData)
 
virtual void * preInsert (bool copyEmbedding, bool copyIDs, bool notifyObservers, bool edgeFilter, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap, int *newNodes, int *newEdges)
 Callback notifying subclasses that some graph is about to be insert() -ed. More...
 
virtual void nodeInserted (void *userData, node original, node copy)
 Callback notifying subclasses that insert() copied a node. More...
 
virtual void edgeInserted (void *userData, edge original, edge copy)
 Callback notifying subclasses that insert() copied an edge. More...
 
virtual void postInsert (void *userData, int newNodes, int newEdges)
 Callback notifying subclasses that an insert() call has finished. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ogdf::Observable< GraphObserver, Graph >
void clearObservers ()
 
const ListPure< GraphObserver * > & getObservers () const
 

Detailed Description

Data type for general directed graphs (adjacency list representation).

In embedded graphs, adjacency lists are given in clockwise order.

Thread Safety

The class Graph allows shared access of threads to const methods only. If one thread executes a non-const method, shared access is no longer thread-safe.

Iteration

You may iterate over the nodes and edges of a graph using C++11 range-based for loops. Find some examples below.

  • Iterate over all nodes v of graph G using c++11 syntax :

    for(node v : G.nodes) {
    // do stuff with node v
    }

  • Iterate over all nodes v of graph G :

    for(node v = G.firstNode(); v != nullptr; v = v->succ()) {
    // do stuff with node v
    }

  • Iterate over all edges e of graph G using c++11 syntax :

    for(edge e : G.edges) {
    // do stuff with node v
    }

  • Iterate over all incident edges of node v using c++11 syntax:
    for(adjEntry adj : v->adjEntries) {
    edge e = adj->theEdge();
    // do stuff with edge e
    }

Definition at line 862 of file Graph_d.h.

Member Typedef Documentation

◆ adjEntry_iterator

Provides a bidirectional iterator to an entry in an adjacency list.

Definition at line 891 of file Graph_d.h.

◆ edge_iterator

Provides a bidirectional iterator to an edge in a graph.

Definition at line 889 of file Graph_d.h.

◆ node_iterator

Provides a bidirectional iterator to a node in a graph.

Definition at line 887 of file Graph_d.h.

Member Enumeration Documentation

◆ EdgeType

enum ogdf::Graph::EdgeType
strong

The type of edges (only used in derived classes).

Enumerator
association 
generalization 
dependency 

Definition at line 901 of file Graph_d.h.

◆ NodeType

enum ogdf::Graph::NodeType
strong

The type of nodes.

Enumerator
vertex 
dummy 
generalizationMerger 
generalizationExpander 
highDegreeExpander 
lowDegreeExpander 
associationClass 

Definition at line 904 of file Graph_d.h.

Constructor & Destructor Documentation

◆ Graph() [1/3]

ogdf::Graph::Graph ( )

Constructs an empty graph.

◆ Graph() [2/3]

ogdf::Graph::Graph ( const Graph copy)

Constructs a graph that is a copy of G.

The constructor assures that the adjacency lists of nodes in the constructed graph are in the same order as the adjacency lists in G. This is in particular important when dealing with embedded graphs.

Parameters
copyis the graph that will be copied.
See also
insert()

◆ Graph() [3/3]

ogdf::Graph::Graph ( Graph &&  move)
delete

◆ ~Graph()

virtual ogdf::Graph::~Graph ( )
virtual

Destructor.

Member Function Documentation

◆ adjEntryRegistry() [1/2]

internal::GraphAdjRegistry& ogdf::Graph::adjEntryRegistry ( )
inline

Returns a reference to the registry of adjEntry arrays associated with this graph.

Definition at line 1633 of file Graph_d.h.

◆ adjEntryRegistry() [2/2]

const internal::GraphAdjRegistry& ogdf::Graph::adjEntryRegistry ( ) const
inline

Returns a const reference to the registry of adjEntry arrays associated with this graph.

Definition at line 1636 of file Graph_d.h.

◆ allEdges()

template<class CONTAINER >
void ogdf::Graph::allEdges ( CONTAINER &  edgeContainer) const
inline

Returns a container with all edges of the graph.

Template Parameters
CONTAINERis the type of the edge container which is returned.
Parameters
edgeContaineris assigned the list of all edges.

Definition at line 1038 of file Graph_d.h.

◆ allNodes()

template<class CONTAINER >
void ogdf::Graph::allNodes ( CONTAINER &  nodeContainer) const
inline

Returns a container with all nodes of the graph.

Template Parameters
CONTAINERis the type of node container which is returned.
Parameters
nodeContaineris assigned the container of all nodes.

Definition at line 1028 of file Graph_d.h.

◆ chooseEdge()

edge ogdf::Graph::chooseEdge ( std::function< bool(edge)>  includeEdge = [](edge) { return true;},
bool  isFastTest = true 
) const

Returns a random edge.

nullptr is returned if no feasible edge exists.

See also
chooseIteratorFrom

◆ chooseNode()

node ogdf::Graph::chooseNode ( std::function< bool(node)>  includeNode = [](node) { return true;},
bool  isFastTest = true 
) const

Returns a random node.

nullptr is returned if no feasible node exists.

See also
chooseIteratorFrom

◆ clear()

virtual void ogdf::Graph::clear ( )
virtual

Removes all nodes and all edges from the graph.

Reimplemented in ogdf::GraphCopyBase, ogdf::GraphCopy, ogdf::GraphCopySimple, ogdf::OverlappingGraphCopy, and ogdf::TwoSAT.

◆ collapse()

template<class NODELIST >
void ogdf::Graph::collapse ( NODELIST &  nodesToCollapse)
inline

Collapses all nodes in the list nodesToCollapse to the first node in the list.

Parallel edges are removed.

Template Parameters
NODELISTis the type of input node list.
Parameters
nodesToCollapseis the list of nodes that will be collapsed. This list will be empty after the call.

Definition at line 1444 of file Graph_d.h.

◆ consistencyCheck()

void ogdf::Graph::consistencyCheck ( ) const

Asserts that this graph is consistent.

◆ contract()

node ogdf::Graph::contract ( edge  e,
bool  keepSelfLoops = false 
)

Contracts edge e while preserving the order of adjacency entries.

Parameters
eis the edge to be contracted.
keepSelfLoopsdetermines whether edges parallel to e will result in self-loops or not (in the latter case, they will also be contracted).
Returns
The endpoint of e to which all edges have been moved. The implementation ensures this to be the source of the former edge e.

◆ delEdge()

virtual void ogdf::Graph::delEdge ( edge  e)
virtual

Removes edge e from the graph.

Reimplemented in ogdf::GraphCopy, ogdf::GraphCopySimple, ogdf::PlanRepExpansion, and ogdf::OverlappingGraphCopy.

◆ delNode()

virtual void ogdf::Graph::delNode ( node  v)
virtual

Removes node v and all incident edges from the graph.

Reimplemented in ogdf::GraphCopyBase, and ogdf::OverlappingGraphCopy.

◆ edgeInserted()

virtual void ogdf::Graph::edgeInserted ( void *  userData,
edge  original,
edge  copy 
)
inlineprotectedvirtual

Callback notifying subclasses that insert() copied an edge.

Parameters
userDatavalue returned from the initial preInsert() call
originalthe original edge
copythe created copy

Reimplemented in ogdf::GraphCopy, and ogdf::GraphCopySimple.

Definition at line 1886 of file Graph_d.h.

◆ edgeRegistry() [1/2]

internal::GraphEdgeRegistry& ogdf::Graph::edgeRegistry ( )
inline

Returns a reference to the registry of edge arrays associated with this graph.

Definition at line 1625 of file Graph_d.h.

◆ edgeRegistry() [2/2]

const internal::GraphEdgeRegistry& ogdf::Graph::edgeRegistry ( ) const
inline

Returns a const reference to the registry of edge arrays associated with this graph.

Definition at line 1628 of file Graph_d.h.

◆ empty()

bool ogdf::Graph::empty ( ) const
inline

Returns true iff the graph is empty, i.e., contains no nodes.

Definition at line 971 of file Graph_d.h.

◆ firstEdge()

edge ogdf::Graph::firstEdge ( ) const
inline

Returns the first edge in the list of all edges.

Definition at line 995 of file Graph_d.h.

◆ firstNode()

node ogdf::Graph::firstNode ( ) const
inline

Returns the first node in the list of all nodes.

Definition at line 989 of file Graph_d.h.

◆ genus()

int ogdf::Graph::genus ( ) const

Returns the genus of the graph's embedding.

The genus of a graph is defined as follows. Let G be a graph with m edges, n nodes, nz isolated vertices, fc face cycles, and c connected components. Then,

\[ genus(G) = (m - n - nz - fc + 2c)/2 \]

Returns
the genus of the graph's current embedding; if this is 0, then the graph is planarly embedded.

◆ insert() [1/8]

std::pair<int, int> ogdf::Graph::insert ( const CCsInfo info,
int  cc,
NodeArray< node > &  nodeMap,
EdgeArray< edge > &  edgeMap 
)
inline

Inserts a copy of a given connected component cc into this graph.

See the other insert() variants for details, this method is a short-cut for inserting a whole connected component cc as described by CCsInfo info.

Definition at line 1794 of file Graph_d.h.

◆ insert() [2/8]

std::pair<int, int> ogdf::Graph::insert ( const Graph G)
inline

Inserts a copy of a given Graph G into this graph.

See the other insert() variants for details, this method is a short-cut for inserting a whole Graph G without the need to specify node or edge maps.

Definition at line 1838 of file Graph_d.h.

◆ insert() [3/8]

std::pair<int, int> ogdf::Graph::insert ( const Graph G,
NodeArray< node > &  nodeMap,
EdgeArray< edge > &  edgeMap 
)
inline

Inserts a copy of a given Graph G into this graph.

See the other insert() variants for details, this method is a short-cut for inserting a whole Graph G.

Definition at line 1814 of file Graph_d.h.

◆ insert() [4/8]

template<OGDF_NODE_ITER NI, OGDF_EDGE_FILTER EF, bool copyIDs, bool notifyObservers>
std::pair< int, int > ogdf::Graph::insert ( const NI &  nodesBegin,
const NI &  nodesEnd,
const EF &  edgeFilter,
NodeArray< node > &  nodeMap,
EdgeArray< edge > &  edgeMap 
)

Inserts a copy of a given subgraph into this graph.

Inserts copies of the nodes given by the iterator pair nodesBegin ... nodesEnd into this Graph and, for each of these nodes, sets the corresponding value in nodeMap to the newly created node. The same happens with all incident edges for which function edgeFilter returns true, although an edge is only inserted if both its endpoints were also inserted (i.e., the corresponding values in nodeMap are non-null). This method always copies the embedding of the subgraph without an overhead.

Template Parameters
NIThe iterator type used for nodesBegin ... nodesEnd.
EFThe function type used for filtering edges, e.g. std::function<bool(edge)>.
copyIDsif explicitly set to true, the newly inserted nodes and edges will have the same IDs as their originals. The Graph datastructure will become corrupt if one of the IDs is already present in the graph. By default, new IDs are generated as by newNode() and newEdge().
notifyObserversif explicitly set to false, no GraphObservers will be notified and (Node-,Edge-,AdjEntry-)Arrays won't grow. Only use if you know what you are doing!
Parameters
nodesBeginIterator to the first node to insert.
nodesEndIterator one past the last node to insert.
edgeFilterFunction returning true for all edges that should be inserted.
nodeMapA NodeArray registered with the Graph of the nodes in nodesBegin ... nodesEnd. For each of these original nodes, this map will point to the newly-created copy after this call returns. Note that this map may only contain nullptr values, otherwise the result is undefined.
edgeMapAn EdgeArray registered with the Graph of the edges in edgesBegin ... edgesEnd. For each of these original edges, this map will point to the newly-created copy after this call returns. Note that this map may only contain nullptr values, otherwise the result is undefined.
Returns
a pair (n, m) where n is the number of created nodes and m is the number of created edges.

Definition at line 205 of file InducedSubgraph.h.

◆ insert() [5/8]

template<OGDF_NODE_ITER NI, OGDF_EDGE_ITER EI, bool copyEmbedding, bool copyIDs, bool notifyObservers>
std::pair< int, int > ogdf::Graph::insert ( const NI &  nodesBegin,
const NI &  nodesEnd,
const EI &  edgesBegin,
const EI &  edgesEnd,
NodeArray< node > &  nodeMap,
EdgeArray< edge > &  edgeMap 
)

Inserts a copy of a given subgraph into this graph.

Inserts copies of the nodes given by the iterator pair nodesBegin ... nodesEnd into this Graph and, for each of these nodes, sets the corresponding value in nodeMap to the newly created node. The same happens with the edges in edgesBegin ... edgesEnd and new edges in edgeMap, although an edge is only inserted if both its endpoints were also inserted (i.e., the corresponding values in nodeMap are non-null).

Template Parameters
NIThe iterator type used for nodesBegin ... nodesEnd.
EIThe iterator type used for edgesBegin ... edgesEnd.
copyEmbeddingif explicitly set to false, the inserted subgraph will have an arbitrary embedding. Otherwise, the embedding of the inserted subgraph will be copied from the original.
copyIDsif explicitly set to true, the newly inserted nodes and edges will have the same IDs as their originals. The Graph datastructure will become corrupt if one of the IDs is already present in the graph. By default, new IDs are generated as by newNode() and newEdge().
notifyObserversif explicitly set to false, no GraphObservers will be notified and (Node-,Edge-,AdjEntry-)Arrays won't grow. Only use if you know what you are doing!
Parameters
nodesBeginIterator to the first node to insert.
nodesEndIterator one past the last node to insert.
edgesBeginIterator to the first edge to insert (if its endpoints are also inserted).
edgesEndIterator one past the last edge to insert (if its endpoints are also inserted).
nodeMapA NodeArray registered with the Graph of the nodes in nodesBegin ... nodesEnd. After this call returns, for each of these original nodes, this map will point to the newly-created copy. Note that all (and only) edges in edgesBegin ... edgesEnd will be created if they have non-null endpoints after the call, which includes user-supplied non-null values present when the function is called. It is thus recommended to pass a map with only nullptrs. However, it is possible to use the same nodeMap for multiple calls of insert using edge iterators (which then of course will contain non-null values for the second call onwards).
edgeMapAn EdgeArray registered with the Graph of the edges in edgesBegin ... edgesEnd. For each of these original edges, this map will point to the newly-created copy after this call returns.
Returns
a pair (n, m) where n is the number of created nodes and m is the number of created edges.

Definition at line 93 of file InducedSubgraph.h.

◆ insert() [6/8]

template<OGDF_NODE_LIST NL>
std::pair< int, int > ogdf::Graph::insert ( const NL &  nodeList,
const EdgeSet< false > &  edgeSet,
NodeArray< node > &  nodeMap,
EdgeArray< edge > &  edgeMap 
)

Inserts a copy of a given subgraph into this graph.

See the other insert() variants for details, this method is a short-cut for a container of nodes together with an EdgeSet<false> used for filtering edges.

Definition at line 157 of file GraphSets.h.

◆ insert() [7/8]

template<OGDF_NODE_LIST NL>
std::pair< int, int > ogdf::Graph::insert ( const NL &  nodeList,
const EdgeSet< true > &  edgeSet,
NodeArray< node > &  nodeMap,
EdgeArray< edge > &  edgeMap 
)

Inserts a copy of a given subgraph into this graph.

See the other insert() variants for details, this method is a short-cut for a container of nodes together with an EdgeSet<true> used for filtering edges.

Definition at line 145 of file GraphSets.h.

◆ insert() [8/8]

template<OGDF_NODE_LIST NL, OGDF_EDGE_LIST EL>
std::pair<int, int> ogdf::Graph::insert ( const NL &  nodeList,
const EL &  edgeList,
NodeArray< node > &  nodeMap,
EdgeArray< edge > &  edgeMap 
)
inline

Inserts a copy of a given subgraph into this graph.

See the other insert() variants for details, this method is a short-cut for a container of nodes together with a further container used for iterating edges.

Definition at line 1775 of file Graph_d.h.

◆ insertAdjEntry() [1/2]

static void ogdf::Graph::insertAdjEntry ( adjEntry  oldAdj,
adjEntry  newAdj,
Direction  dir 
)
inlinestaticprivate

Definition at line 2027 of file Graph_d.h.

◆ insertAdjEntry() [2/2]

static void ogdf::Graph::insertAdjEntry ( node  n,
adjEntry  newAdj,
Direction  dir 
)
inlinestaticprivate

Definition at line 2035 of file Graph_d.h.

◆ insertNodes()

template<OGDF_NODE_ITER NI, bool notifyObservers, bool copyIDs>
void ogdf::Graph::insertNodes ( const NI &  nodesBegin,
const NI &  nodesEnd,
NodeArray< node, true > &  nodeMap,
int &  newNodes,
void *  cbData 
)
private

Definition at line 67 of file InducedSubgraph.h.

◆ lastEdge()

edge ogdf::Graph::lastEdge ( ) const
inline

Returns the last edge in the list of all edges.

Definition at line 998 of file Graph_d.h.

◆ lastNode()

node ogdf::Graph::lastNode ( ) const
inline

Returns the last node in the list of all nodes.

Definition at line 992 of file Graph_d.h.

◆ maxAdjEntryIndex()

int ogdf::Graph::maxAdjEntryIndex ( ) const
inline

Returns the largest used adjEntry index.

Definition at line 986 of file Graph_d.h.

◆ maxEdgeIndex()

int ogdf::Graph::maxEdgeIndex ( ) const
inline

Returns the largest used edge index.

Definition at line 983 of file Graph_d.h.

◆ maxNodeIndex()

int ogdf::Graph::maxNodeIndex ( ) const
inline

Returns the largest used node index.

Definition at line 980 of file Graph_d.h.

◆ move()

void ogdf::Graph::move ( edge  e,
adjEntry  adjSrc,
Direction  dirSrc,
adjEntry  adjTgt,
Direction  dirTgt 
)

Moves edge e to a different adjacency list.

The source adjacency entry of e is moved to the adjacency list containing adjSrc and is inserted before or after adjSrc, and its target adjacency entry to the adjacency list containing adjTgt and is inserted before or after adjTgt; e is afterwards an edge from owner(adjSrc) to owner(adjTgt).

Parameters
eis the edge to be moved.
adjSrcis the adjaceny entry before or after which the source adjacency entry of e will be inserted.
dirSrcspecifies if the source adjacency entry of e will be inserted before or after adjSrc.
adjTgtis the adjaceny entry before or after which the target adjacency entry of e will be inserted.
dirTgtspecifies if the target adjacency entry of e will be inserted before or after adjTgt.

◆ moveAdj() [1/2]

void ogdf::Graph::moveAdj ( adjEntry  adj,
node  w 
)
private

moves adjacency entry to node w

◆ moveAdj() [2/2]

void ogdf::Graph::moveAdj ( adjEntry  adjMove,
Direction  dir,
adjEntry  adjPos 
)
inline

Moves adjacency entry adjMove before or after adjPos.

Precondition
adjMove and adjAfter are distinct entries in the same adjacency list.
Parameters
adjMoveis an entry in the adjacency list of a node in this graph.
adjPosis an entry in the same adjacency list as adjMove.
dirspecifies if adjMove is moved before or after adjPos.

Definition at line 1522 of file Graph_d.h.

◆ moveAdjAfter()

void ogdf::Graph::moveAdjAfter ( adjEntry  adjMove,
adjEntry  adjAfter 
)
inline

Moves adjacency entry adjMove after adjAfter.

Precondition
adjMove and adjAfter are distinct entries in the same adjacency list.
Parameters
adjMoveis an entry in the adjacency list of a node in this graph.
adjAfteris an entry in the same adjacency list as adjMove.

Definition at line 1538 of file Graph_d.h.

◆ moveAdjBefore()

void ogdf::Graph::moveAdjBefore ( adjEntry  adjMove,
adjEntry  adjBefore 
)
inline

Moves adjacency entry adjMove before adjBefore.

Precondition
adjMove and adjBefore are distinct entries in the same adjacency list.
Parameters
adjMoveis an entry in the adjacency list of a node in this graph.
adjBeforeis an entry in the same adjacency list as adjMove.

Definition at line 1553 of file Graph_d.h.

◆ moveSource() [1/2]

void ogdf::Graph::moveSource ( edge  e,
adjEntry  adjSrc,
Direction  dir 
)

Moves the source node of edge e to a specific position in an adjacency list.

Let w be the node containing adjSrc. If e=(v,u) before, then e=(w,u) afterwards. Inserts the adjacency entry before or after adjSrc according to dir.

Parameters
eis the edge whose source node is moved.
adjSrcis the adjacency entry before or after which the source adjacency entry of e is inserted.
dirspecifies if the source adjacency entry of e is inserted before or after adjSrc.

◆ moveSource() [2/2]

void ogdf::Graph::moveSource ( edge  e,
node  w 
)

Moves the source node of edge e to node w.

If e=(v,u) before, then e=(w,u) afterwards.

Parameters
eis the edge whose source node is moved.
wis the new source node of e.

◆ moveTarget() [1/2]

void ogdf::Graph::moveTarget ( edge  e,
adjEntry  adjTgt,
Direction  dir 
)

Moves the target node of edge e to a specific position in an adjacency list.

Let w be the node containing adjTgt. If e=(v,u) before, then e=(v,w) afterwards. Inserts the adjacency entry before or after adjTgt according to dir.

Parameters
eis the edge whose target node is moved.
adjTgtis the adjacency entry before or after which the target adjacency entry of e is inserted.
dirspecifies if the target adjacency entry of e is inserted before or after adjTgt.

◆ moveTarget() [2/2]

void ogdf::Graph::moveTarget ( edge  e,
node  w 
)

Moves the target node of edge e to node w.

If e=(v,u) before, then e=(v,w) afterwards.

Parameters
eis the edge whose target node is moved.
wis the new target node of e.

◆ newEdge() [1/5]

edge ogdf::Graph::newEdge ( adjEntry  adjSrc,
adjEntry  adjTgt,
Direction  dir = Direction::after,
int  index = -1 
)
inline

Creates a new edge at predefined positions in the adjacency lists.

Let v be the node whose adjacency list contains adjSrc, and w the node whose adjacency list contains adjTgt. Then, the created edge is (v,w).

Parameters
adjSrcis the adjacency entry before / after which the new edge is inserted in the adjacency list of v.
adjTgtis the adjacency entry before / after which the new edge is inserted in the adjacency list of w.
dirspecifies if the edge is inserted before or after the given adjacency entries.
indexis the index that will be assigned to the newly created edge. If negative or not given will use the next free index maxEdgeIndex(). Passing an edge index that is already in use results in an inconsistent data structure. Only specify this parameter if you know what you're doing!
Returns
the newly created edge.

Definition at line 1135 of file Graph_d.h.

◆ newEdge() [2/5]

edge ogdf::Graph::newEdge ( adjEntry  adjSrc,
node  w,
int  index = -1 
)
inline

Creates a new edge at predefined positions in the adjacency lists.

Let v be the node whose adjacency list contains adjSrc. Then, the created edge is (v,w).

Parameters
adjSrcis the adjacency entry after which the new edge is inserted in the adjacency list of v.
wis the target node of the new edge; the edge is added at the end of the adjacency list of w.
indexis the index that will be assigned to the newly created edge. If negative or not given will use the next free index maxEdgeIndex(). Passing an edge index that is already in use results in an inconsistent data structure. Only specify this parameter if you know what you're doing!
Returns
the newly created edge.

Definition at line 1113 of file Graph_d.h.

◆ newEdge() [3/5]

edge ogdf::Graph::newEdge ( node  v,
adjEntry  adjTgt,
int  index = -1 
)
inline

Creates a new edge at predefined positions in the adjacency lists.

Let w be the node whose adjacency list contains adjTgt. Then, the created edge is (v,w).

Parameters
vis the source node of the new edge; the edge is added at the end of the adjacency list of v.
adjTgtis the adjacency entry after which the new edge is inserted in the adjacency list of w.
indexis the index that will be assigned to the newly created edge. If negative or not given will use the next free index maxEdgeIndex(). Passing an edge index that is already in use results in an inconsistent data structure. Only specify this parameter if you know what you're doing!
Returns
the newly created edge.

Definition at line 1094 of file Graph_d.h.

◆ newEdge() [4/5]

edge ogdf::Graph::newEdge ( node  v,
node  w,
int  index = -1 
)
inline

Creates a new edge (v,w) and returns it.

Parameters
vis the source node of the newly created edge.
wis the target node of the newly created edge.
indexis the index that will be assigned to the newly created edge. If negative or not given will use the next free index maxEdgeIndex(). Passing an edge index that is already in use results in an inconsistent data structure. Only specify this parameter if you know what you're doing!
Returns
the newly created edge.

Definition at line 1075 of file Graph_d.h.

◆ newEdge() [5/5]

template<typename S , typename T >
edge ogdf::Graph::newEdge ( src,
Direction  dirSrc,
tgt,
Direction  dirTgt,
int  index = -1 
)
inline

Creates a new edge at predefined positions in the adjacency lists.

Let v either be the node src or the node whose adjacency list contains the adjEntry src, and w either the node tgt or the node whose adjacency list contains the adjEntry tgt. Then, the created edge is (v,w).

Parameters
srcis v or the adjacency entry before / after which the new edge is inserted in the adjacency list of v.
dirSrcspecifies if the edge is inserted before or after adjSrc.
tgtis w or the adjacency entry before / after which the new edge is inserted in the adjacency list of w.
dirTgtspecifies if the edge is inserted before or after adjTgt.
indexis the index that will be assigned to the newly created edge. If negative or not given will use the next free index maxEdgeIndex(). Passing an edge index that is already in use results in an inconsistent data structure. Only specify this parameter if you know what you're doing!
Returns
the newly created edge.

Definition at line 1160 of file Graph_d.h.

◆ newNode()

node ogdf::Graph::newNode ( int  index = -1)
inline

Creates a new node and returns it.

Parameters
indexis the index that will be assigned to the newly created node. If negative or not given will use the next free index maxNodeIndex(). Passing a node index that is already in use results in an inconsistent data structure. Only specify this parameter if you know what you're doing!
Returns
the newly created node.

Definition at line 1056 of file Graph_d.h.

◆ nodeInserted()

virtual void ogdf::Graph::nodeInserted ( void *  userData,
node  original,
node  copy 
)
inlineprotectedvirtual

Callback notifying subclasses that insert() copied a node.

Parameters
userDatavalue returned from the initial preInsert() call
originalthe original node
copythe created copy

Reimplemented in ogdf::GraphCopyBase.

Definition at line 1877 of file Graph_d.h.

◆ nodeRegistry() [1/2]

internal::GraphNodeRegistry& ogdf::Graph::nodeRegistry ( )
inline

Returns a reference to the registry of node arrays associated with this graph.

Definition at line 1617 of file Graph_d.h.

◆ nodeRegistry() [2/2]

const internal::GraphNodeRegistry& ogdf::Graph::nodeRegistry ( ) const
inline

Returns a const reference to the registry of node arrays associated with this graph.

Definition at line 1620 of file Graph_d.h.

◆ numberOfEdges()

int ogdf::Graph::numberOfEdges ( ) const
inline

Returns the number of edges in the graph.

Definition at line 977 of file Graph_d.h.

◆ numberOfNodes()

int ogdf::Graph::numberOfNodes ( ) const
inline

Returns the number of nodes in the graph.

Definition at line 974 of file Graph_d.h.

◆ operator const internal::GraphAdjRegistry &()

ogdf::Graph::operator const internal::GraphAdjRegistry & ( ) const
inline

Definition at line 1638 of file Graph_d.h.

◆ operator const internal::GraphEdgeRegistry &()

ogdf::Graph::operator const internal::GraphEdgeRegistry & ( ) const
inline

Definition at line 1630 of file Graph_d.h.

◆ operator const internal::GraphNodeRegistry &()

ogdf::Graph::operator const internal::GraphNodeRegistry & ( ) const
inline

Definition at line 1622 of file Graph_d.h.

◆ operator=() [1/2]

Graph& ogdf::Graph::operator= ( const Graph copy)

Overwrites this graph to be a copy of G.

The assignment operator assures that the adjacency lists of nodes in the constructed graph are in the same order as the adjacency lists in G. This is in particular important when dealing with embedded graphs.

Parameters
copyis the graph to be copied.
Returns
this graph.
See also
insert()

◆ operator=() [2/2]

Graph& ogdf::Graph::operator= ( Graph &&  move)
delete

◆ postInsert()

virtual void ogdf::Graph::postInsert ( void *  userData,
int  newNodes,
int  newEdges 
)
inlineprotectedvirtual

Callback notifying subclasses that an insert() call has finished.

Parameters
userDatavalue returned from the initial preInsert() call
newNodesfinal number of created nodes
newEdgesfinal number of created edges

Definition at line 1895 of file Graph_d.h.

◆ preInsert()

virtual void* ogdf::Graph::preInsert ( bool  copyEmbedding,
bool  copyIDs,
bool  notifyObservers,
bool  edgeFilter,
NodeArray< node > &  nodeMap,
EdgeArray< edge > &  edgeMap,
int *  newNodes,
int *  newEdges 
)
inlineprotectedvirtual

Callback notifying subclasses that some graph is about to be insert() -ed.

See its implementation in GraphCopy for an example.

Parameters
copyEmbeddingvalue of the template parameter copyEmbedding of the insert() call
copyIDsvalue of the template parameter copyIDs of the insert() call
notifyObserversvalue of the template parameter notifyObservers of the insert() call
edgeFiltertrue if the insert variant with an edge filter instead of an iterator is used
nodeMapvalue of the template parameter nodeMap of the insert() call
edgeMapvalue of the template parameter edgeMap of the insert() call
newNodespointer to the counter of inserted nodes, will be valid until after postInsert()
newEdgespointer to the counter of inserted edges, will be valid until after postInsert()
Returns
arbitrary value, which will be passed to all following callbacks

Reimplemented in ogdf::GraphCopyBase.

Definition at line 1865 of file Graph_d.h.

◆ pureNewEdge()

edge ogdf::Graph::pureNewEdge ( node  src,
node  tgt,
int  index 
)
inlineprivate

Creates a new edge object with id index and corresponding AdjElements and adds it to the list of edges.

Registered EdgeArrays won't get resized and GraphObservers also won't get notified of the new edge.

Warning
The adjacency lists of the passed nodes won't be updated.
Parameters
srcThe source node of the new edge.
tgtThe target node of the new edge.
indexThe index of the new edge.
Returns
The newly created edge.

Definition at line 1994 of file Graph_d.h.

◆ pureNewNode()

node ogdf::Graph::pureNewNode ( int  index)
inlineprivate

Creates a new node object with id index and adds it to the list of nodes.

Registered NodeArrays won't get resized and GraphObservers also won't get notified of the new node.

Parameters
indexThe index of the new node.
Returns
The newly created node.

Definition at line 1963 of file Graph_d.h.

◆ representsCombEmbedding()

bool ogdf::Graph::representsCombEmbedding ( ) const
inline

Returns true iff the graph represents a combinatorial embedding.

Returns
true if the current embedding (given by the adjacency lists) represents a combinatorial embedding, false otherwise.

Definition at line 1601 of file Graph_d.h.

◆ resetEdgeIdCount()

void ogdf::Graph::resetEdgeIdCount ( int  maxId)

Resets the edge id count to maxId.

The next edge will get edge id maxId +1. Use this function with caution! It is provided as an efficient way to reduce the edge id count. The Graph class increments the edge id count whenever an edge is created; free edge ids resulting from removing edges are not reused (there is not something like a freelist).

This function is , e.g., useful, when a lot of edges has been added and all these edges are removed again (without creating other new edges meanwile). Then, it is safe to reduce the edge id count to the value it had before, cf. the following code snippet:

int oldIdCount = G.maxEdgeIndex();
Create some edges
...
Remove all these edges again
G.resetEdgeIdCount(oldIdCount);

Reducing the edge id count will reduce the memory consumption of edge arrays associated with the graph.

Precondition
-1 <= maxId <= maximal edge id in the graph.
Parameters
maxIdis an upper bound of the edge ids in the graph.

◆ resetNodeIdCount()

void ogdf::Graph::resetNodeIdCount ( int  maxId)

◆ restoreAllEdges()

void ogdf::Graph::restoreAllEdges ( )

Restore all hidden edges and invalidate all HiddenEdgeSets.

◆ reverseAdjEdges() [1/2]

void ogdf::Graph::reverseAdjEdges ( )

Reverses all adjacency lists.

◆ reverseAdjEdges() [2/2]

void ogdf::Graph::reverseAdjEdges ( node  v)
inline

Reverses the adjacency list of v.

Parameters
vis the node whose adjacency list will be reveresed.

Definition at line 1512 of file Graph_d.h.

◆ reverseAllEdges()

void ogdf::Graph::reverseAllEdges ( )

Reverses all edges in the graph.

◆ reverseEdge()

void ogdf::Graph::reverseEdge ( edge  e)

Reverses the edge e, i.e., exchanges source and target node.

◆ searchEdge()

edge ogdf::Graph::searchEdge ( node  v,
node  w,
bool  directed = false 
) const

Searches and returns an edge connecting nodes v and w in time O( min(deg(v ), deg(w ))).

Parameters
vis the first endpoint of the edge to be searched.
wis the second endpoint of the edge to be searched.
directediff set to true, enforces that v must be the source node and w the target node of the edge.
Returns
an edge (v,w) (or (w,v) for !directed) if such an edge exists, nullptr otherwise.

◆ sort() [1/2]

template<class ADJ_ENTRY_LIST >
void ogdf::Graph::sort ( node  v,
const ADJ_ENTRY_LIST &  newOrder 
)
inline

Sorts the adjacency list of node v according to newOrder.

Precondition
newOrder contains exactly the adjacency entries of v!
Template Parameters
ADJ_ENTRY_LISTis the type of the input adjacency entry list.
Parameters
vis the node whose adjacency list will be sorted.
newOrderis the list of adjacency entries of v in the new order.

Definition at line 1474 of file Graph_d.h.

◆ sort() [2/2]

template<class IT >
void ogdf::Graph::sort ( node  v,
IT  begin,
IT  end 
)
inline

Sorts the adjacency list of node v according to the range denoted by two iterators.

Precondition
begin ... end contains exactly the adjacency entries of v!
Template Parameters
ITis the type of the input adjacency entry list iterator.
Parameters
vis the node whose adjacency list will be sorted.
beginis the iterator to the adjacency entry that should come first
endis the iterator one past the adjacency entry that should come last

Definition at line 1490 of file Graph_d.h.

◆ split()

virtual edge ogdf::Graph::split ( edge  e)
virtual

Splits edge e into two edges introducing a new node.

Let e=(v,w). Then, the resulting two edges are e=(v,u) and e'=(u,w), where u is a new node.

Note
The edge e is modified by this operation.
Parameters
eis the edge to be split.
Returns
The edge e'.

Reimplemented in ogdf::PlanRep, ogdf::GraphCopy, ogdf::PlanRepExpansion, ogdf::PlanRepInc, ogdf::PlanRepUML, and ogdf::ClusterPlanRep.

◆ splitNode()

node ogdf::Graph::splitNode ( adjEntry  adjStartLeft,
adjEntry  adjStartRight 
)

Splits a node while preserving the order of adjacency entries.

This method splits a node v into two nodes vl and vr. Node vl receives all adjacent edges of v from adjStartLeft until the edge preceding adjStartRight, and vr the remaining nodes (thus adjStartRight is the first edge that goes to vr). The order of adjacency entries is preserved. Additionally, a new edge (vl,vr) is created, such that this edge is inserted before adjStartLeft and adjStartRight in the adjacency lists of vl and vr.

When adjStartLeft and adjStartRight are the same, vl receives all edges and the edge (vl, vr) is inserted before adjStartLeft in the adjacency list of vl.

Node v is modified to become node vl, and node vr is returned. This method is useful when modifying combinatorial embeddings.

Parameters
adjStartLeftis the first entry that goes to the left node.
adjStartRightis the first entry that goes to the right node.
Returns
the newly created node.

◆ swapAdjEdges()

void ogdf::Graph::swapAdjEdges ( adjEntry  adj1,
adjEntry  adj2 
)
inline

Exchanges two entries in an adjacency list.

Precondition
adj1 and adj2 must be belong to the same adjacency list.
Parameters
adj1the first adjacency entry to be swapped.
adj2the secomd adjacency entry to be swapped.

Definition at line 1571 of file Graph_d.h.

◆ unsplit() [1/2]

virtual void ogdf::Graph::unsplit ( edge  eIn,
edge  eOut 
)
virtual

Undoes a split operation.

For two edges eIn = (x,u) and eOut = (u,y), removes node u by joining eIn and eOut. Edge eOut is removed and eIn is reused.

Precondition
eIn and eOut are the only edges incident with u and none of them is a self-loop.
Parameters
eInis the (only) incoming edge of u.
eOutis the (only) outgoing edge of u.

Reimplemented in ogdf::GraphCopy, and ogdf::PlanRepExpansion.

◆ unsplit() [2/2]

void ogdf::Graph::unsplit ( node  u)

Undoes a split operation.

Removes node u by joining the two edges adjacent to u. The outgoing edge of u is removed and the incoming edge is reused

Precondition
u has exactly one incoming and one outgoing edge, and none of them is a self-loop.
Parameters
uis the node to be unsplit.

Friends And Related Function Documentation

◆ GraphObserver

friend class GraphObserver
friend

Definition at line 865 of file Graph_d.h.

Member Data Documentation

◆ edges

The container containing all edge objects.

Definition at line 927 of file Graph_d.h.

◆ m_edgeIdCount

int ogdf::Graph::m_edgeIdCount
private

The Index that will be assigned to the next created edge.

Definition at line 870 of file Graph_d.h.

◆ m_hiddenEdgeSets

List<HiddenEdgeSet*> ogdf::Graph::m_hiddenEdgeSets
private

The list of hidden edges.

Definition at line 876 of file Graph_d.h.

◆ m_nodeIdCount

int ogdf::Graph::m_nodeIdCount
private

The Index that will be assigned to the next created node.

Definition at line 869 of file Graph_d.h.

◆ m_regAdjArrays

internal::GraphAdjRegistry ogdf::Graph::m_regAdjArrays
private

The registered adjEntry arrays.

Definition at line 874 of file Graph_d.h.

◆ m_regEdgeArrays

internal::GraphEdgeRegistry ogdf::Graph::m_regEdgeArrays
private

The registered edge arrays.

Definition at line 873 of file Graph_d.h.

◆ m_regNodeArrays

internal::GraphNodeRegistry ogdf::Graph::m_regNodeArrays
private

The registered node arrays.

Definition at line 872 of file Graph_d.h.

◆ nodes

The container containing all node objects.

Definition at line 924 of file Graph_d.h.


The documentation for this class was generated from the following files:
ogdf::adjEntry
AdjElement * adjEntry
The type of adjacency entries.
Definition: Graph_d.h:71
ogdf::edge
EdgeElement * edge
The type of edges.
Definition: Graph_d.h:67
ogdf::node
NodeElement * node
The type of nodes.
Definition: Graph_d.h:63
ogdf::Graph::edges
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Definition: Graph_d.h:927
ogdf::graphml::Attribute::G
@ G