aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::Arc Class Reference

The base class for all directed edges. More...

#include <graphElements.h>

Public Member Functions

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

Private Member Functions

void _setTail_ (NodeId id)
 modifies the tail of the arc
void _setHead_ (NodeId id)
 modifies the head of the arc
void operator- ()
 reverses the direction of the arc

Private Attributes

NodeId n1
 the extremal nodes of the edge (their order is unimportant)
NodeId n2

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;
Arc(NodeId tail, NodeId head)
basic constructor. Creates tail -> head.

Definition at line 261 of file graphElements.h.

Constructor & Destructor Documentation

◆ Arc() [1/2]

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

basic constructor. Creates tail -> head.

Warning
the order in which the nodes are passed is important

References head(), and tail().

Referenced by Arc(), operator=(), and operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Arc() [2/2]

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

copy constructor

References Arc().

Here is the call graph for this function:

◆ ~Arc()

gum::Arc::~Arc ( )

destructor

Member Function Documentation

◆ _setHead_()

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

modifies the head of the arc

◆ _setTail_()

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

modifies the tail of the arc

◆ first()

GUM_NODISCARD NodeId gum::Arc::first ( ) const

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

References GUM_NODISCARD.

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

Here is the caller graph for this function:

◆ head()

GUM_NODISCARD NodeId gum::Arc::head ( ) const

returns the head of the arc

References GUM_NODISCARD.

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

Here is the caller graph for this function:

◆ operator-()

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

reverses the direction of the arc

◆ operator=()

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

copy operator

References Arc().

Here is the call graph for this function:

◆ operator==()

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

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).

References Arc().

Here is the call graph for this function:

◆ other()

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

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

References GUM_NODISCARD.

◆ second()

GUM_NODISCARD NodeId gum::Arc::second ( ) const

returns the node ID of the other extremal node ID

References GUM_NODISCARD.

◆ tail()

GUM_NODISCARD NodeId gum::Arc::tail ( ) const

returns the tail of the arc

References GUM_NODISCARD.

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

Here is the caller graph for this function:

Member Data Documentation

◆ n1

NodeId gum::Arc::n1
private

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

Definition at line 319 of file graphElements.h.

◆ n2

NodeId gum::Arc::n2
private

Definition at line 320 of file graphElements.h.


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