Loading...
Searching...
No Matches
SBCGraphNode Class Reference

This class is the base class to describe a node in a directed graph with a horizontal structure.

Debugging

SBCGraphArcCollectionpredecessors
 The list of predecessors.
 
SBCGraphArcCollectionsuccessors
 The list of successors.
 
void printConnections () const
 Prints the list of connections of the nodes.
 

Constructors and destructors

 SBCGraphNode ()
 Builds a graph node with no connections.
 
virtual ~SBCGraphNode ()
 Deletes the graph node. If the node has predecessors or successors, any reference to this node there are automatically removed.
 

Topology

SBCReferenceListLink * addSuccessor (SBCGraphNode *graphNode)
 Adds a successor to the graph node.
 
SBCReferenceListLink * addPredecessor (SBCGraphNode *graphNode)
 Adds a predecessor to the graph node.
 
void removeSuccessor (SBCGraphNode *graphNode)
 Removes a successor to the graph node.
 
void removePredecessor (SBCGraphNode *graphNode)
 Removes a predecessor to the graph node.
 
void removeSuccessor (SBCReferenceListLink *referenceListLink)
 Removes a successor to the graph node (constant time)
 
void removePredecessor (SBCReferenceListLink *referenceListLink)
 Removes a predecessor to the graph node (constant time)
 
void removeAllSuccessors ()
 Removes all successors to the graph node.
 
void removeAllPredecessors ()
 Removes all predecessors to the graph node.
 
unsigned int getNumberOfSuccessors () const
 Returns the number of successors.
 
unsigned int getNumberOfPredecessors () const
 Returns the number of predecessors.
 
SBCGraphArcgetArcToSuccessor (SBCGraphNode *graphNode) const
 Returns the arc to the successor graphNode (0 if not found)
 
SBCGraphArcgetArcFromPredecessor (SBCGraphNode *graphNode) const
 Returns the arc from the predecessor graphNode (0 if not found)
 

Successors traversal

iterator beginSuccessors ()
 Returns a begin iterator to successors.
 
iterator endSuccessors ()
 Returns an end iterator to successors.
 
reverse_iterator rbeginSuccessors ()
 Returns a reverse begin iterator to successors.
 
reverse_iterator rendSuccessors ()
 Returns a reverse end iterator to successors.
 

Predecessors traversal

iterator beginPredecessors ()
 Returns a begin iterator to predecessors.
 
iterator endPredecessors ()
 Returns an end iterator to predecessors.
 
reverse_iterator rbeginPredecessors ()
 Returns a reverse begin iterator to predecessors.
 
reverse_iterator rendPredecessors ()
 Returns a reverse end iterator to predecessors.
 

Additional Inherited Members

- Public Member Functions inherited from SBCReferenceTarget
unsigned int getMemoryFootprint () const
 
void printReferencesToOwners () const
 
 SBCReferenceTarget ()
 
virtual ~SBCReferenceTarget ()
 
- Protected Member Functions inherited from SBCReferenceTarget
void removeAllReferenceOwners ()
 
 SBCReferenceTarget (SBCReferenceTargetData *dataPointer)
 
- Protected Attributes inherited from SBCReferenceTarget
SBCReferenceTargetData * dataPointer
 

Member Function Documentation

◆ addPredecessor()

SBCReferenceListLink * SBCGraphNode::addPredecessor ( SBCGraphNode g)

The node pointed by g becomes a predecessor of the current node, while the current node becomes a successor of the node pointed by g. The function returns a pointer to the link holding a reference to the connection, which may be used for constant-time removal of the reference to the successor (see SBCClass for more information on references).

Parameters
gA pointer to the graph node that becomes a predecessor of the node.

◆ addSuccessor()

SBCReferenceListLink * SBCGraphNode::addSuccessor ( SBCGraphNode g)

The node pointed by g becomes a successor of the current node, while the current node becomes a predecessor of the node pointed by g. The function returns a pointer to the link holding a reference to the connection, which may be used for constant-time removal of the reference to the successor (see SBCClass for more information on references).

Parameters
gA pointer to the graph node that becomes a successor of the node.

◆ printConnections()

void SBCGraphNode::printConnections ( ) const

This functions prints the list of connections to and from this node. This should be used for debugging purposes only.

◆ removeAllPredecessors()

void SBCGraphNode::removeAllPredecessors ( )

The time complexity of this operation is proportional to the number of predecessors.

◆ removeAllSuccessors()

void SBCGraphNode::removeAllSuccessors ( )

The time complexity of this operation is proportional to the number of successors.

◆ removePredecessor() [1/2]

void SBCGraphNode::removePredecessor ( SBCGraphNode graphNode)

The time complexity of this operation is proportional to the number of predecessors.

◆ removePredecessor() [2/2]

void SBCGraphNode::removePredecessor ( SBCReferenceListLink *  referenceLink)

The time complexity of this operation is constant since referenceLink is a direct pointer to the link holding the reference to the predecessor in the list of references to predecessors. This reference was returned by SBCGraphNode::addPredecessor.

◆ removeSuccessor() [1/2]

void SBCGraphNode::removeSuccessor ( SBCGraphNode graphNode)

The time complexity of this operation is proportional to the number of successors.

◆ removeSuccessor() [2/2]

void SBCGraphNode::removeSuccessor ( SBCReferenceListLink *  referenceLink)

The time complexity of this operation is constant since referenceLink is a direct pointer to the link holding the reference to the successor in the list of references to successors. This reference was returned by SBCGraphNode::addSuccessor.