aGrUM  0.14.1
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
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...

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.

## ◆ 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

## ◆ Arc() [2/2]

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

copy constructor

## ◆ ~Arc()

 gum::Arc::~Arc ( )

destructor

## Member Function Documentation

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

 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:

returns the head of the arc

Here is the caller graph for this function:

## ◆ operator!=()

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

## ◆ operator-()

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

reverses the direction of the arc

## ◆ operator=()

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

copy operator

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

## ◆ other()

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

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

## ◆ second()

 NodeId gum::Arc::second ( ) const

returns the node ID of the other extremal node ID

## ◆ tail()

 NodeId gum::Arc::tail ( ) const

returns the tail of the arc

Here is the caller graph for this function:

## ◆ n1

 NodeId gum::Arc::n1
private

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

Definition at line 314 of file graphElements.h.

## ◆ n2

 NodeId gum::Arc::n2
private

Definition at line 314 of file graphElements.h.

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