Web Analytics Made Easy - Statcounter
Skip to content

Class SBCGraphNode#

ClassList > SBCGraphNode

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

  • #include <SBCGraphNode.hpp>

Inherits the following classes: SBCReferenceTarget

Inherited by the following classes: SBCGraphNodeTemplate

Classes#

Type Name
class iterator
class reverse_iterator

Public Functions#

Type Name
SBCGraphNode ()
Constructs a graph node with no connections.
SBCReferenceListLink * addPredecessor (SBCGraphNode * graphNode)
Adds a predecessor to the graph node.
SBCReferenceListLink * addSuccessor (SBCGraphNode * graphNode)
Adds a successor to the graph node.
iterator beginPredecessors ()
Returns a begin iterator to predecessors.
iterator beginSuccessors ()
Returns a begin iterator to successors.
iterator endPredecessors ()
Returns an end iterator to predecessors.
iterator endSuccessors ()
Returns an end iterator to successors.
SBCGraphArc * getArcFromPredecessor (SBCGraphNode * graphNode) const
Returns the arc from the predecessor graphNode (0 if not found)
SBCGraphArc * getArcToSuccessor (SBCGraphNode * graphNode) const
Returns the arc to the successor graphNode (0 if not found)
unsigned int getNumberOfPredecessors () const
Returns the number of predecessors.
unsigned int getNumberOfSuccessors () const
Returns the number of successors.
void printConnections () const
Prints the list of connections of the nodes.
reverse_iterator rbeginPredecessors ()
Returns a reverse begin iterator to predecessors.
reverse_iterator rbeginSuccessors ()
Returns a reverse begin iterator to successors.
void removeAllPredecessors ()
Removes all predecessors to the graph node.
void removeAllSuccessors ()
Removes all successors to the graph node.
void removePredecessor (SBCGraphNode * graphNode)
Removes a predecessor to the graph node.
void removePredecessor (SBCReferenceListLink * referenceListLink)
Removes a predecessor to the graph node (constant time)
void removeSuccessor (SBCGraphNode * graphNode)
Removes a successor to the graph node.
void removeSuccessor (SBCReferenceListLink * referenceListLink)
Removes a successor to the graph node (constant time)
reverse_iterator rendPredecessors ()
Returns a reverse end iterator to predecessors.
reverse_iterator rendSuccessors ()
Returns a reverse end iterator to successors.
virtual ~SBCGraphNode ()
Destroys the graph node, removing any references from its predecessors and successors.

Public Functions inherited from SBCReferenceTarget#

See SBCReferenceTarget

Type Name
SBCReferenceTarget ()
Builds the reference target.
unsigned int getMemoryFootprint () const
Returns the memory footprint.
void printReferencesToOwners () const
Prints the references to the owners of this reference target.
virtual ~SBCReferenceTarget ()
Destructor.

Protected Attributes#

Type Name
SBCGraphArcCollection * predecessors
The list of predecessors.
SBCGraphArcCollection * successors
The list of successors.

Protected Attributes inherited from SBCReferenceTarget#

See SBCReferenceTarget

Type Name
SBCReferenceTargetData * dataPointer
A pointer to the private data.

Protected Functions inherited from SBCReferenceTarget#

See SBCReferenceTarget

Type Name
SBCReferenceTarget (SBCReferenceTargetData * dataPointer)
Protected constructor.
void removeAllReferenceOwners ()
Stops all the reference owners from referencing this reference target.

Detailed Description#

Short name: SBGraphNode

Public Functions Documentation#

function SBCGraphNode#

Constructs a graph node with no connections.

SBCGraphNode::SBCGraphNode () 

The newly created node has no successors or predecessors.


function addPredecessor#

Adds a predecessor to the graph node.

SBCReferenceListLink * SBCGraphNode::addPredecessor (
    SBCGraphNode * graphNode
) 

Adds a predecessor to the current node.

The node pointed by g becomes a predecessor of the current node, while the current node becomes a successor of g. The function returns a pointer to the reference link that holds the connection, which can be used for constant‑time removal of the predecessor reference.

Parameters:

  • g A pointer to the graph node that becomes a predecessor of this node.

Returns:

A pointer to the reference link representing the connection to the predecessor.


function addSuccessor#

Adds a successor to the graph node.

SBCReferenceListLink * SBCGraphNode::addSuccessor (
    SBCGraphNode * graphNode
) 

Adds a successor to the current node.

The node pointed by g becomes a successor of the current node, while the current node becomes a predecessor of g. The function returns a pointer to the reference link that holds the connection, which can be used for constant‑time removal of the successor reference.

Parameters:

  • g A pointer to the graph node that becomes a successor of this node.

Returns:

A pointer to the reference link representing the connection to the successor.


function beginPredecessors#

Returns a begin iterator to predecessors.

iterator SBCGraphNode::beginPredecessors () 

Returns an iterator to the first predecessor of the node.

The iterator can be used to traverse all predecessor nodes of this graph node.

Returns:

An iterator positioned at the beginning of the predecessors collection, or an end iterator if there are no predecessors.


function beginSuccessors#

Returns a begin iterator to successors.

iterator SBCGraphNode::beginSuccessors () 

Returns an iterator to the first successor of the node.

The iterator can be used to traverse all successor nodes of this graph node.

Returns:

An iterator positioned at the beginning of the successors collection, or an end iterator if there are no successors.


function endPredecessors#

Returns an end iterator to predecessors.

iterator SBCGraphNode::endPredecessors () 

Returns an iterator marking the end of the predecessors collection.

Returns:

An iterator representing the end sentinel for the predecessors collection.


function endSuccessors#

Returns an end iterator to successors.

iterator SBCGraphNode::endSuccessors () 

Returns an iterator marking the end of the successors collection.

Returns:

An iterator representing the end sentinel for the successors collection.


function getArcFromPredecessor#

Returns the arc from the predecessor graphNode (0 if not found)

SBCGraphArc * SBCGraphNode::getArcFromPredecessor (
    SBCGraphNode * graphNode
) const

Retrieves the arc connecting a specific predecessor to this node.

Searches the list of predecessors for a node matching graphNode and returns the associated arc.

Parameters:

  • graphNode A pointer to the predecessor node whose connecting arc is requested.

Returns:

A pointer to the SBCGraphArc representing the connection from graphNode, or nullptr if no such predecessor exists.


function getArcToSuccessor#

Returns the arc to the successor graphNode (0 if not found)

SBCGraphArc * SBCGraphNode::getArcToSuccessor (
    SBCGraphNode * graphNode
) const

Retrieves the arc connecting this node to a specific successor.

Searches the list of successors for a node matching graphNode and returns the associated arc.

Parameters:

  • graphNode A pointer to the successor node whose connecting arc is requested.

Returns:

A pointer to the SBCGraphArc representing the connection to graphNode, or nullptr if no such successor exists.


function getNumberOfPredecessors#

Returns the number of predecessors.

unsigned int SBCGraphNode::getNumberOfPredecessors () const

Returns the number of predecessors of the node.

Returns:

The count of predecessor connections.


function getNumberOfSuccessors#

Returns the number of successors.

unsigned int SBCGraphNode::getNumberOfSuccessors () const

Returns the number of successors of the node.

Returns:

The count of successor connections.


function printConnections#

Prints the list of connections of the nodes.

void SBCGraphNode::printConnections () const

Prints the connections of the node for debugging purposes.

The method outputs the node's address, its owner references, and lists of successors and predecessors to standard output.


function rbeginPredecessors#

Returns a reverse begin iterator to predecessors.

reverse_iterator SBCGraphNode::rbeginPredecessors () 

Returns a reverse iterator to the last predecessor of the node.

The reverse iterator can be used to traverse the predecessors in reverse order.

Returns:

A reverse iterator positioned at the last predecessor, or a reverse end iterator if there are no predecessors.


function rbeginSuccessors#

Returns a reverse begin iterator to successors.

reverse_iterator SBCGraphNode::rbeginSuccessors () 

Returns a reverse iterator to the last successor of the node.

The reverse iterator can be used to traverse the successors in reverse order.

Returns:

A reverse iterator positioned at the last successor, or a reverse end iterator if there are no successors.


function removeAllPredecessors#

Removes all predecessors to the graph node.

void SBCGraphNode::removeAllPredecessors () 

Removes all predecessors of the node.

All predecessor connections are removed, and the corresponding successor references in the predecessor nodes are also cleared. The operation runs in time proportional to the number of predecessors.


function removeAllSuccessors#

Removes all successors to the graph node.

void SBCGraphNode::removeAllSuccessors () 

Removes all successors of the node.

All successor connections are removed, and the corresponding predecessor references in the successor nodes are also cleared. The operation runs in time proportional to the number of successors.


function removePredecessor [1/2]#

Removes a predecessor to the graph node.

void SBCGraphNode::removePredecessor (
    SBCGraphNode * graphNode
) 

Removes the specified predecessor from the node.

The node pointed by g is removed from the list of predecessors, and the corresponding successor reference in g is also removed.

Parameters:

  • g A pointer to the predecessor node to be removed.

function removePredecessor [2/2]#

Removes a predecessor to the graph node (constant time)

void SBCGraphNode::removePredecessor (
    SBCReferenceListLink * referenceListLink
) 

Removes a predecessor using a direct reference link.

This operation runs in constant time because referenceLink directly points to the link holding the reference to the predecessor. The link must have been obtained from SBCGraphNode::addPredecessor.

Parameters:

  • referenceLink A pointer to the reference link representing the predecessor connection to be removed.

function removeSuccessor [1/2]#

Removes a successor to the graph node.

void SBCGraphNode::removeSuccessor (
    SBCGraphNode * graphNode
) 

Removes the specified successor from the node.

The node pointed by g is removed from the list of successors, and the corresponding predecessor reference in g is also removed.

Parameters:

  • g A pointer to the successor node to be removed.

function removeSuccessor [2/2]#

Removes a successor to the graph node (constant time)

void SBCGraphNode::removeSuccessor (
    SBCReferenceListLink * referenceListLink
) 

Removes a successor using a direct reference link.

This operation runs in constant time because referenceLink directly points to the link holding the reference to the successor. The link must have been obtained from SBCGraphNode::addSuccessor.

Parameters:

  • referenceLink A pointer to the reference link representing the successor connection to be removed.

function rendPredecessors#

Returns a reverse end iterator to predecessors.

reverse_iterator SBCGraphNode::rendPredecessors () 

Returns a reverse iterator marking the reverse end of the predecessors collection.

Returns:

A reverse iterator representing the reverse end sentinel for the predecessors collection.


function rendSuccessors#

Returns a reverse end iterator to successors.

reverse_iterator SBCGraphNode::rendSuccessors () 

Returns a reverse iterator marking the reverse end of the successors collection.

Returns:

A reverse iterator representing the reverse end sentinel for the successors collection.


function ~SBCGraphNode#

Destroys the graph node, removing any references from its predecessors and successors.

virtual SBCGraphNode::~SBCGraphNode () 


Protected Attributes Documentation#

variable predecessors#

The list of predecessors.

SBCGraphArcCollection* SBCGraphNode::predecessors;


variable successors#

The list of successors.

SBCGraphArcCollection* SBCGraphNode::successors;