Regina 7.3 Calculation Engine
Public Member Functions | Friends | List of all members
regina::ModelLinkGraphArc Class Reference

A reference to an outgoing edge from a node of a model graph for a knot or link. More...

#include <link/modellinkgraph.h>

Public Member Functions

 ModelLinkGraphArc ()
 Initialises this to a null arc. More...
 
 ModelLinkGraphArc (ModelLinkGraphNode *node, int arc)
 Initialises this to the given arc exiting the given node of a model graph. More...
 
 ModelLinkGraphArc (const ModelLinkGraphArc &)=default
 Creates a new copy of the given arc reference. More...
 
ModelLinkGraphNodenode () const
 The node of the model graph from which this arc exits. More...
 
int arc () const
 Indicates which arc this is amongst the four arcs exiting the underlying node of the model graph. More...
 
bool operator== (const ModelLinkGraphArc &rhs) const
 Tests whether this and the given arc reference are identical. More...
 
bool operator!= (const ModelLinkGraphArc &rhs) const
 Tests whether this and the given arc reference are not identical. More...
 
ModelLinkGraphArcoperator= (const ModelLinkGraphArc &)=default
 Sets this to be a copy of the given arc reference. More...
 
ModelLinkGraphArc opposite () const
 Returns the arc that exits the same node as this, but from the opposite side. More...
 
ModelLinkGraphArc traverse () const
 Returns the same edge of the model graph, but seen from the other endpoint. More...
 
ModelLinkGraphArc next () const
 Returns the next arc after this when walking through the graph as though it were a link, in a direction away from the current node. More...
 
ModelLinkGraphArc prev () const
 Returns the previous arc before this when walking through the graph as though it were a link, in a direction away from the* current node. More...
 
ModelLinkGraphArcoperator++ ()
 Changes to the next outgoing link arc from the same node. More...
 
ModelLinkGraphArc operator++ (int)
 Changes to the next outgoing link arc from the same node. More...
 
ModelLinkGraphArcoperator-- ()
 Changes to the previous outgoing link arc from the same node. More...
 
ModelLinkGraphArc operator-- (int)
 Changes to the previous outgoing link arc from the same node. More...
 
 operator bool () const
 Tests whether this is a non-null arc. More...
 

Friends

class ModelLinkGraph
 

Detailed Description

A reference to an outgoing edge from a node of a model graph for a knot or link.

Edges of model graphs are not directed, and so the same edge will appear twice as a ModelLinkGraphArc (once from each of its endpoints).

This class is a simple wrapper that stores (i) a pointer to the relevant node of the graph; and (ii) an integer to denote which of the four outgoing arcs we are using from that node. Recall that the four outgoing arcs for each node are indexed in clockwise order.

A "null arc" is one whose node is the null pointer.

These objects are small enough to pass by value and swap with std::swap(), with no need for any specialised move operations or swap functions.

Constructor & Destructor Documentation

◆ ModelLinkGraphArc() [1/3]

regina::ModelLinkGraphArc::ModelLinkGraphArc ( )
inline

Initialises this to a null arc.

The pointer returned by node() will be null, and the integer returned by arc() will be 0.

◆ ModelLinkGraphArc() [2/3]

regina::ModelLinkGraphArc::ModelLinkGraphArc ( ModelLinkGraphNode node,
int  arc 
)
inline

Initialises this to the given arc exiting the given node of a model graph.

Recall that the four arcs exiting a node are numbered 0,1,2,3 in a clockwise order around the node.

The given node may be null, in which case this will become a null arc. If you are creating a null arc, then it is highly recommended that you pass arc as 0 also, so that comparison tests treat this null reference as equal to a null reference created by the zero-argument constructor.

Parameters
nodethe node of the model graph that this arc exits.
arcan integer in the range 0 to 3 inclusive, indicating which of the four arcs exiting node this represents.

◆ ModelLinkGraphArc() [3/3]

regina::ModelLinkGraphArc::ModelLinkGraphArc ( const ModelLinkGraphArc )
default

Creates a new copy of the given arc reference.

Member Function Documentation

◆ arc()

int regina::ModelLinkGraphArc::arc ( ) const
inline

Indicates which arc this is amongst the four arcs exiting the underlying node of the model graph.

For each node of a model graph, the four arcs exiting that node are numbered 0,1,2,3 in a clockwise order.

Returns
an integer between 0 and 3 inclusive indicating one of the four arcs exiting node().

◆ next()

ModelLinkGraphArc regina::ModelLinkGraphArc::next ( ) const
inline

Returns the next arc after this when walking through the graph as though it were a link, in a direction away from the current node.

This routine will move to the other endpoint of the graph edge described by this arc, and will then return the opposite arc at the resulting node (i.e., not just pointing backwards along the same edge).

For any arc a, calling a.next() is equivalent to calling a.traverse().opposite().

Precondition
This is not a null arc, i.e., node() does not return null.
Returns
the next arc after this when walking through the graph as though it were a link.

◆ node()

ModelLinkGraphNode * regina::ModelLinkGraphArc::node ( ) const
inline

The node of the model graph from which this arc exits.

Returns
the corresponding node, or null if this is a null arc.

◆ operator bool()

regina::ModelLinkGraphArc::operator bool ( ) const
inline

Tests whether this is a non-null arc.

Returns
true if this is not a null arc (i.e., node() does not return a null pointer), or false if this is a null arc.

◆ operator!=()

bool regina::ModelLinkGraphArc::operator!= ( const ModelLinkGraphArc rhs) const
inline

Tests whether this and the given arc reference are not identical.

Two references are identical if and only if they return the same values for both node() and arc().

Warning
If you create a null arc by calling ModelLinkGraphArc(null, i) for some non-zero i, then this will not be considered equal to the null arc created by calling ModelLinkGraphArc(), since the latter is equivalent to calling ModelLinkGraphArc(null, 0).

true if and only if this and rhs are not identical.

◆ operator++() [1/2]

ModelLinkGraphArc & regina::ModelLinkGraphArc::operator++ ( )
inline

Changes to the next outgoing link arc from the same node.

This effectively rotates the arc in a clockwise direction around the node. In particular, it increments the value returned by arc(), modulo 4.

This is a preincrement operator: the object will be changed, and then a reference to it will be returned.

Precondition
This is not a null arc, i.e., node() does not return null.
Python
Not present. The postincrement operator is available in Python under the name inc().
Returns
a reference to this object.

◆ operator++() [2/2]

ModelLinkGraphArc regina::ModelLinkGraphArc::operator++ ( int  )
inline

Changes to the next outgoing link arc from the same node.

This effectively rotates the arc in a clockwise direction around the node. In particular, it increments the value returned by arc(), modulo 4.

This is a postincrement operator: the object will be changed, but a copy of the original arc will be returned.

Precondition
This is not a null arc, i.e., node() does not return null.
Python
This routine is available under the name inc().
Returns
a copy of this object before the change took place.

◆ operator--() [1/2]

ModelLinkGraphArc & regina::ModelLinkGraphArc::operator-- ( )
inline

Changes to the previous outgoing link arc from the same node.

This effectively rotates the arc in an anticlockwise direction around the node. In particular, it decrements the value returned by arc(), modulo 4.

This is a predecrement operator: the object will be changed, and then a reference to it will be returned.

Precondition
This is not a null arc, i.e., node() does not return null.
Python
Not present. The postdecrement operator is available in Python under the name dec().
Returns
a reference to this object.

◆ operator--() [2/2]

ModelLinkGraphArc regina::ModelLinkGraphArc::operator-- ( int  )
inline

Changes to the previous outgoing link arc from the same node.

This effectively rotates the arc in an anticlockwise direction around the node. In particular, it decrements the value returned by arc(), modulo 4.

This is a postdecrement operator: the object will be changed, but a copy of the original arc will be returned.

Precondition
This is not a null arc, i.e., node() does not return null.
Python
This routine is available under the name dec().
Returns
a copy of this object before the change took place.

◆ operator=()

ModelLinkGraphArc & regina::ModelLinkGraphArc::operator= ( const ModelLinkGraphArc )
default

Sets this to be a copy of the given arc reference.

Returns
a reference to this object.

◆ operator==()

bool regina::ModelLinkGraphArc::operator== ( const ModelLinkGraphArc rhs) const
inline

Tests whether this and the given arc reference are identical.

Two references are identical if and only if they return the same values for both node() and arc().

Warning
If you create a null arc by calling ModelLinkGraphArc(null, i) for some non-zero i, then this will not be considered equal to the null arc created by calling ModelLinkGraphArc(), since the latter is equivalent to calling ModelLinkGraphArc(null, 0).

true if and only if this and rhs are identical.

◆ opposite()

ModelLinkGraphArc regina::ModelLinkGraphArc::opposite ( ) const
inline

Returns the arc that exits the same node as this, but from the opposite side.

Recall that the four arcs exiting each node are numbered in clockwise order. The return value will therefore have the same node() as this, but its arc() value will be two more than this (modulo 4).

Note that, for any arc a, a.opposite().opposite() is identical to a.

Precondition
This is not a null arc, i.e., node() does not return null.
Returns
the opposite arc exiting the same node.

◆ prev()

ModelLinkGraphArc regina::ModelLinkGraphArc::prev ( ) const
inline

Returns the previous arc before this when walking through the graph as though it were a link, in a direction away from the* current node.

This routine will jump to the opposite arc at the current node, and then move to the other endpoint of the graph edge described by that opposite arc.

For any arc a, calling a.prev() is equivalent to calling a.opposite().traverse().

Precondition
This is not a null arc, i.e., node() does not return null.
Returns
the previous arc before this when walking through the graph as though it were a link.

◆ traverse()

ModelLinkGraphArc regina::ModelLinkGraphArc::traverse ( ) const
inline

Returns the same edge of the model graph, but seen from the other endpoint.

Recall that each undirected edge of a model graph has two corresponding ModelLinkGraphArc objects, one for each of its endpoints. If this object represents one of these arcs for some underlying edge of the graph, then then return value represents the other.

Note that, for any arc a, a.traverse().traverse() is identical to a.

Precondition
This is not a null arc, i.e., node() does not return null.
Returns
the arc at the other end of the underlying edge of the model graph.

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

Copyright © 1999-2023, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).