aGrUM  0.13.2
gum::Arc Class Reference

The base class for all directed edgesThis class is used as a basis for manipulating all directed edges (i.e., edges in which the order of the nodes is meaningful). More...

#include <graphElements.h>

Public Member Functions

Constructors / Destructors
 Arc (NodeId tail, NodeId head)
 basic constructor. Creates tail -> head. More...
 
 Arc (const Arc &src)
 copy constructor More...
 
 ~Arc ()
 destructor More...
 
Accessors
NodeId tail () const
 returns the tail of the arc More...
 
NodeId head () const
 returns the head of the arc More...
 
NodeId other (NodeId id) const
 returns an extremal node of an edge given the ID of the other one More...
 
NodeId first () const
 returns one extremal node ID (whichever one it is is unspecified) More...
 
NodeId second () const
 returns the node ID of the other extremal node ID More...
 
Operators
Arcoperator= (const Arc &src)
 copy operator More...
 
bool operator== (const Arc &src) const
 checks whether two arcs are equal More...
 
bool operator!= (const Arc &src) const
 check if two arcs are different More...
 

Detailed Description

The base class for all directed edges

This class is used as a basis for manipulating all directed edges (i.e., edges in which the order of the nodes is meaningful).

For instance, in an arrow, one node is near the head and the other one is farther, hence these nodes have different status and swapping the nodes results in reversing the direction of the arrow. Thus, the nodes in an arrow can be thought of as asymmetric and the arrow's graphical representation contains a pointed extremity so as to account for this asymmetry. In aGrUM, the latter is taken into account by Arc.

Usage example:
// creation of an arc (directed edge) from 3 to 4
Arc arc1 (3,4);
*
// compare two arcs
if (Arc(3,4) != Arc(4,3)) cerr << "ok, this is asymmetric" << endl;
// get the extremities of the edge
cerr << arc1.tail() << " = 3 and " << arc1.head() << " = 4\n";
cerr << "arc1 = (3 -> " << edge1.other (3) << ")" << endl;
// display an arc in a console
cerr << arc1 << endl;

Definition at line 250 of file graphElements.h.

Constructor & Destructor Documentation

gum::Arc::Arc ( NodeId  tail,
NodeId  head 
)

basic constructor. Creates tail -> head.

Warning
the order in which the nodes are passed is important
gum::Arc::Arc ( const Arc src)

copy constructor

gum::Arc::~Arc ( )

destructor

Member Function Documentation

void gum::Arc::__setHead ( NodeId  id)
private

modifies the head of the arc

void gum::Arc::__setTail ( NodeId  id)
private

modifies the tail of the arc

NodeId gum::Arc::first ( ) const

returns one extremal node ID (whichever one it is is unspecified)

Referenced by gum::BarrenNodesFinder::barrenNodes().

+ Here is the caller graph for this function:

NodeId gum::Arc::head ( ) const

returns the head of the arc

Referenced by gum::BarrenNodesFinder::barrenNodes(), gum::ArcGraphPart::eraseArc(), gum::InfluenceDiagram< GUM_SCALAR >::eraseArc(), gum::BayesNet< GUM_SCALAR >::eraseArc(), gum::DAGCycleDetector::hasCycleFromModifications(), and gum::BayesNet< GUM_SCALAR >::reverseArc().

+ Here is the caller graph for this function:

bool gum::Arc::operator!= ( const Arc src) const

check if two arcs are different

Two arcs are considered different if they have different head and/or tail (by different we mean they have different ID).

void gum::Arc::operator- ( )
private

reverses the direction of the arc

Arc& gum::Arc::operator= ( const Arc src)

copy operator

bool gum::Arc::operator== ( const Arc src) const

checks whether two arcs are equal

Two arcs are considered equal if they have the same head and tail (by same we mean they have the same ID).

NodeId gum::Arc::other ( NodeId  id) const

returns an extremal node of an edge given the ID of the other one

NodeId gum::Arc::second ( ) const

returns the node ID of the other extremal node ID

NodeId gum::Arc::tail ( ) const

returns the tail of the arc

Referenced by gum::BarrenNodesFinder::barrenNodes(), gum::ArcGraphPart::eraseArc(), gum::InfluenceDiagram< GUM_SCALAR >::eraseArc(), gum::BayesNet< GUM_SCALAR >::eraseArc(), gum::DAGCycleDetector::hasCycleFromModifications(), and gum::BayesNet< GUM_SCALAR >::reverseArc().

+ Here is the caller graph for this function:

Member Data Documentation

NodeId gum::Arc::n1
private

the extremal nodes of the edge (their order is unimportant)

Definition at line 314 of file graphElements.h.

NodeId gum::Arc::n2
private

Definition at line 314 of file graphElements.h.


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