Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

Node sets. More...

#include <ogdf/basic/NodeSet.h>

Public Member Functions

 NodeSet (const Graph &G)
 Creates an empty node set associated with graph G. More...
 
 NodeSet (const NodeSet &V)
 Copy constructor. More...
 
 ~NodeSet ()
 
void clear ()
 Removes all nodes from S. More...
 
void insert (node v)
 Inserts node v into S. More...
 
bool isMember (node v) const
 Returns true if node v is contained in S, false otherwise. More...
 
const List< node > & nodes () const
 Returns a reference to the list of nodes contained in S. More...
 
NodeSet & operator= (const NodeSet &V)
 Assignment operator. More...
 
void remove (node v)
 Removes node v from S. More...
 
int size () const
 Returns the size of S. More...
 

Private Attributes

NodeArray< ListIterator< node > > m_it
 m_it[v] contains the list iterator pointing to v if v is contained in S, an invalid list iterator otherwise. More...
 
List< node > m_nodes
 The list of nodes contained in S. More...
 

Detailed Description

Node sets.

A node set maintains a subset S of the nodes contained in an associated graph. This kind of node set provides efficient operations for testing membership, insertion and deletion of elements, and clearing the set.

In contrast to NodeSetPure, a NodeSet provides efficient access to the number of nodes stored in the set.

See also

Definition at line 249 of file NodeSet.h.

Constructor & Destructor Documentation

◆ NodeSet() [1/2]

ogdf::NodeSet::NodeSet ( const Graph &  G)
inlineexplicit

Creates an empty node set associated with graph G.

Definition at line 252 of file NodeSet.h.

◆ ~NodeSet()

ogdf::NodeSet::~NodeSet ( )
inline

Definition at line 255 of file NodeSet.h.

◆ NodeSet() [2/2]

ogdf::NodeSet::NodeSet ( const NodeSet &  V)
inline

Copy constructor.

Definition at line 328 of file NodeSet.h.

Member Function Documentation

◆ clear()

void ogdf::NodeSet::clear ( )
inline

Removes all nodes from S.

After this operation, S is empty and still associated with the same graph. The runtime of this operations is O(k), where k is the number of nodes in S before this operation.

Definition at line 292 of file NodeSet.h.

◆ insert()

void ogdf::NodeSet::insert ( node  v)
inline

Inserts node v into S.

This operation has constant runtime.

Precondition
v is a node in the associated graph.

Definition at line 263 of file NodeSet.h.

◆ isMember()

bool ogdf::NodeSet::isMember ( node  v) const
inline

Returns true if node v is contained in S, false otherwise.

This operation has constant runtime.

Precondition
v is a node in the associated graph.

Definition at line 306 of file NodeSet.h.

◆ nodes()

const List<node>& ogdf::NodeSet::nodes ( ) const
inline

Returns a reference to the list of nodes contained in S.

This list can be used for iterating over all nodes in S.

Definition at line 323 of file NodeSet.h.

◆ operator=()

NodeSet& ogdf::NodeSet::operator= ( const NodeSet &  V)
inline

Assignment operator.

Definition at line 335 of file NodeSet.h.

◆ remove()

void ogdf::NodeSet::remove ( node  v)
inline

Removes node v from S.

This operation has constant runtime.

Precondition
v is a node in the associated graph.

Definition at line 276 of file NodeSet.h.

◆ size()

int ogdf::NodeSet::size ( ) const
inline

Returns the size of S.

This operation has constant runtime.

Definition at line 315 of file NodeSet.h.

Member Data Documentation

◆ m_it

NodeArray<ListIterator<node> > ogdf::NodeSet::m_it
private

m_it[v] contains the list iterator pointing to v if v is contained in S, an invalid list iterator otherwise.

Definition at line 347 of file NodeSet.h.

◆ m_nodes

List<node> ogdf::NodeSet::m_nodes
private

The list of nodes contained in S.

Definition at line 350 of file NodeSet.h.


The documentation for this class was generated from the following file: