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

Represents a single node in a model graph for a knot or link. More...

#include <link/modellinkgraph.h>

Inheritance diagram for regina::ModelLinkGraphNode:
regina::MarkedElement regina::ShortOutput< ModelLinkGraphNode > regina::Output< ModelLinkGraphNode, false >

Public Member Functions

size_t index () const
 Returns the index of this node within the overall graph. More...
 
ModelLinkGraphArc arc (int which)
 Returns a reference to one of the four arcs of the graph that exit this node. More...
 
const ModelLinkGraphArcadj (int which) const
 Returns the arc at the other end of the given graph edge that exits this node. More...
 
void writeTextShort (std::ostream &out) const
 Writes a short text representation of this node to the given output stream. More...
 
 ModelLinkGraphNode (const ModelLinkGraphNode &)=delete
 
ModelLinkGraphNodeoperator= (const ModelLinkGraphNode &)=delete
 
size_t markedIndex () const
 Returns the index at which this object is stored in an MarkedVector. More...
 
void writeTextLong (std::ostream &out) const
 A default implementation for detailed output. More...
 
std::string str () const
 Returns a short text representation of this object. More...
 
std::string utf8 () const
 Returns a short text representation of this object using unicode characters. More...
 
std::string detail () const
 Returns a detailed text representation of this object. More...
 

Friends

class ModelLinkGraph
 

Detailed Description

Represents a single node in a model graph for a knot or link.

If a graph has n nodes, then these are numbered 0,...,n-1. The number assigned to this node can be accessed by calling index(). Note that nodes may be reindexed when other nodes are added or removed - if you wish to track a particular node through such operations then you should use a pointer to the relevant ModelLinkGraphNode instead.

Graph nodes do not support value semantics: they cannot be copied, swapped, or manually constructed. Their location in memory defines them, and they are often passed and compared by pointer. End users are never responsible for their memory management; this is all taken care of by the ModelLinkGraph to which they belong.

Member Function Documentation

◆ adj()

const ModelLinkGraphArc & regina::ModelLinkGraphNode::adj ( int  which) const
inline

Returns the arc at the other end of the given graph edge that exits this node.

Let e be the undirected edge of the underlying model graph that corresponds to the given outgoing arc from this node. Recall that there are two ModelLinkGraphArc objects corresponding to e, one for each of its endpoints. One of these will be ModelLinkGraphArc(this, which); this routine returns the other object, which is the ModelLinkGraphArc describing the other endpoint of e.

Note that for a node n, calling n.adj(i) is equivalent to calling n.arc(i).traverse().

Parameters
whichan integer in the range 0 to 3 inclusive, indicating which of the four arcs exiting this node we should examine.
Returns
a reference to the other end of the same undirected edge of the underlying model graph.

◆ arc()

ModelLinkGraphArc regina::ModelLinkGraphNode::arc ( int  which)
inline

Returns a reference to one of the four arcs of the graph that exit this node.

This is equivalent to directly constructing ModelLinkGraphArc(this, which).

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

Parameters
whichan integer in the range 0 to 3 inclusive, indicating which of the four arcs exiting this node we should return.
Returns
a reference to the corresponding arc exiting this node.

◆ detail()

std::string regina::Output< ModelLinkGraphNode , supportsUtf8 >::detail ( ) const
inherited

Returns a detailed text representation of this object.

This text may span many lines, and should provide the user with all the information they could want. It should be human-readable, should not contain extremely long lines (which cause problems for users reading the output in a terminal), and should end with a final newline. There are no restrictions on the underlying character set.

Returns
a detailed text representation of this object.

◆ index()

size_t regina::ModelLinkGraphNode::index ( ) const
inline

Returns the index of this node within the overall graph.

If the graph contains n nodes, then the index will be a number between 0 and n-1 inclusive.

Warning
The index of this node might change if other nodes are added or removed.
Returns
the index of this node.

◆ markedIndex()

size_t regina::MarkedElement::markedIndex ( ) const
inlineinherited

Returns the index at which this object is stored in an MarkedVector.

If this object does not belong to an MarkedVector, the return value is undefined.

Returns
the index at which this object is stored.

◆ str()

std::string regina::Output< ModelLinkGraphNode , supportsUtf8 >::str ( ) const
inherited

Returns a short text representation of this object.

This text should be human-readable, should use plain ASCII characters where possible, and should not contain any newlines.

Within these limits, this short text ouptut should be as information-rich as possible, since in most cases this forms the basis for the Python __str__() and __repr__() functions.

Python
The Python "stringification" function __str__() will use precisely this function, and for most classes the Python __repr__() function will incorporate this into its output.
Returns
a short text representation of this object.

◆ utf8()

std::string regina::Output< ModelLinkGraphNode , supportsUtf8 >::utf8 ( ) const
inherited

Returns a short text representation of this object using unicode characters.

Like str(), this text should be human-readable, should not contain any newlines, and (within these constraints) should be as information-rich as is reasonable.

Unlike str(), this function may use unicode characters to make the output more pleasant to read. The string that is returned will be encoded in UTF-8.

Returns
a short text representation of this object.

◆ writeTextLong()

void regina::ShortOutput< ModelLinkGraphNode , false >::writeTextLong ( std::ostream &  out) const
inlineinherited

A default implementation for detailed output.

This routine simply calls T::writeTextShort() and appends a final newline.

Python
Not present. Instead you can call detail() from the subclass T, which returns this output as a string.
Parameters
outthe output stream to which to write.

◆ writeTextShort()

void regina::ModelLinkGraphNode::writeTextShort ( std::ostream &  out) const
inline

Writes a short text representation of this node to the given output stream.

Python
Not present. Use str() instead.
Parameters
outthe output stream to which to write.

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