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

Represents a single bag in a tree decomposition. More...

#include <treewidth/treedecomposition.h>

Inheritance diagram for regina::TreeBag:
regina::ShortOutput< TreeBag > regina::Output< TreeBag, false >

Public Member Functions

 ~TreeBag ()
 Destroys this bag. More...
 
int size () const
 Returns the number of graph nodes stored in this bag. More...
 
int element (int which) const
 Used to query the individual graph nodes stored in this bag. More...
 
bool contains (int element) const
 Queries whether a given graph node is contained in this bag. More...
 
int index () const
 Returns the index of this bag within the full tree decomposition. More...
 
int type () const
 Returns auxiliary information associated with bags in special classes of tree decompositions. More...
 
int subtype () const
 Returns a secondary level of auxiliary information associated with bags in special classes of tree decompositions. More...
 
BagComparison compare (const TreeBag &rhs) const
 Determines if there is a subset/superset relationship between this and the given bag. More...
 
const TreeBagnext () const
 Used for a postfix iteration through all of the bags in a tree decomposition. More...
 
const TreeBagnextPrefix () const
 Used for a prefix iteration through all of the bags in a tree decomposition. More...
 
const TreeBagparent () const
 Returns the parent of this bag in the underlying rooted tree. More...
 
const TreeBagchildren () const
 Returns the first child of this bag in the underlying rooted tree. More...
 
const TreeBagsibling () const
 Returns the next sibling of this bag in the underlying rooted tree. More...
 
bool isLeaf () const
 Determines if this is a leaf bag. More...
 
void writeTextShort (std::ostream &out) const
 Writes a short text representation of this object to the given output stream. More...
 
TreeBagoperator= (const TreeBag &)=delete
 
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 TreeDecomposition
 

Detailed Description

Represents a single bag in a tree decomposition.

The class TreeDecomposition is used to build, manipulate and iterate over tree decompositions of graphs. A tree decomposition of a graph G consists of (i) an underlying tree T; and (ii) a bag at every node of this tree. Each bag is a set of zero or more nodes of G, and these bags are subject to various constraints as described in the TreeDecomposition class notes.

In Regina, the underlying tree T is a rooted tree, so that every non-root bag has exactly one parent bag, and every bag has some number of children (possibly many, possibly zero).

This class TreeBag represents a single bag in a tree decomposition.

To build a tree decomposition of a graph, see the various TreeDecomposition class constructors.

Note that a bag may be empty (indeed, if you call TreeDecomposition::makeNice() then it is guaranteed that the root bag will be empty).

Member Function Documentation

◆ detail()

std::string regina::Output< TreeBag , supportsUtf8 >::detail
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.

◆ str()

std::string regina::Output< TreeBag , supportsUtf8 >::str
inherited

Returns a short text representation of this object.

This text should be human-readable, should fit on a single line, and should not end with a newline. Where possible, it should use plain ASCII characters.

Python:\n In addition to str(), this is also used as the
Python "stringification" function str().
Returns
a short text representation of this object.

◆ utf8()

std::string regina::Output< TreeBag , supportsUtf8 >::utf8
inherited

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

Like str(), this text should be human-readable, should fit on a single line, and should not end with a newline. In addition, it may use unicode characters to make the output more pleasant to read. This string will be encoded in UTF-8.

Returns
a short text representation of this object.

◆ writeTextLong()

void regina::ShortOutput< TreeBag , 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:\n Not present.
Parameters
outthe output stream to which to write.

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

Copyright © 1999-2020, 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).