Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
Public Member Functions | Private Attributes | Friends
mty::wick::ConnectedComponent Class Reference

std::vector of Vertex that represents the connected component of a Graph. A Graph has typically one ConnectedComponent and free Vertices. More...

#include <graph.h>

Public Member Functions

 ConnectedComponent ()
 Default constructor. Empty ConnectedComponent.
 
 ConnectedComponent (const Vertex &firstVertex)
 Constructor with one parameter. More...
 
 ConnectedComponent (const ConnectedComponent &other)=default
 Copy constructor = C++ default.
 
std::vector< Vertex > const & getVertices () const
 
void addVertex (const Vertex &newVertex)
 Adds a Vertex in the connected component.
 
bool hasValenceLeft () const
 Tells if the ConnectedComponent has contractible Node left. More...
 
const mty::QuantumFieldgetFirstContractibleField () const
 This function returns the mty::QuantumField of the first contractible Node if there is one. If no, this function calls an error. More...
 
int getFirstContractibleVertex () const
 
std::vector< int > getContractibleVertices (const mty::QuantumField *field) const
 Returns the list (in a std::vector) of the Vertices in the ConnectedComponent contractible with field. More...
 
std::shared_ptr< NodegetFirstContractibleNode () const
 
std::vector< std::shared_ptr< Node > > getNodes () const
 Allows to get all nodes of the ConnectedComponent independently of their contractions. More...
 
int connect (int indexVertex)
 Connects the first contractible Node of the ConnectedComponent with the first Node (contractible with the previous one) of the Vertex in position indexVertex of the component. More...
 
bool connect (Vertex &other)
 Tries to connect the first contractible Node of the ConnectedComponent with the Vertex other. More...
 

Private Attributes

std::vector< Vertexvertices
 

Friends

std::ostream & operator<< (std::ostream &fout, const ConnectedComponent &c)
 Overload of operator<< for ConnectedComponent. More...
 

Detailed Description

std::vector of Vertex that represents the connected component of a Graph. A Graph has typically one ConnectedComponent and free Vertices.

Constructor & Destructor Documentation

◆ ConnectedComponent()

mty::wick::ConnectedComponent::ConnectedComponent ( const Vertex firstVertex)
explicit

Constructor with one parameter.

Parameters
firstVertexFirst (and unique for now) Vertex in the component.

Member Function Documentation

◆ connect() [1/2]

int mty::wick::ConnectedComponent::connect ( int  indexVertex)

Connects the first contractible Node of the ConnectedComponent with the first Node (contractible with the previous one) of the Vertex in position indexVertex of the component.

Parameters
indexVertexIndex of the Vertex to contract.
Returns
The degeneracy encountered in the contraction.

◆ connect() [2/2]

bool mty::wick::ConnectedComponent::connect ( Vertex other)

Tries to connect the first contractible Node of the ConnectedComponent with the Vertex other.

Parameters
otherVertex to contract with the first contractible Node.
Returns
True if there is a contraction.
False else.

◆ getContractibleVertices()

vector< int > mty::wick::ConnectedComponent::getContractibleVertices ( const mty::QuantumField field) const

Returns the list (in a std::vector) of the Vertices in the ConnectedComponent contractible with field.

The first constractible vertex is not put in the returned vector except is its degeneracy (see Vertex::getDegeneracy()) is bigger than one, i.e. has more than one Node contractible with field. This is because at each contraction step we contract the first Node of the ConnectedComponent of the Graph with possible other Nodes. The first contractible Node of the ConnectedComponent is then not included in the "other Nodes".

Parameters
fieldmty::QuantumField we want to contract.
Returns
A std::vector filled with Vertices of the ConnectedComponent contractible with field.

◆ getFirstContractibleField()

const QuantumField * mty::wick::ConnectedComponent::getFirstContractibleField ( ) const

This function returns the mty::QuantumField of the first contractible Node if there is one. If no, this function calls an error.

Returns
The mty::QuantumField of the first contractible Node in the component.

◆ getFirstContractibleNode()

shared_ptr< Node > mty::wick::ConnectedComponent::getFirstContractibleNode ( ) const
Returns
The first contractible Node of the ConnectedComponent if there is one.
nullptr else.

◆ getFirstContractibleVertex()

int mty::wick::ConnectedComponent::getFirstContractibleVertex ( ) const
Returns
The position of the first contractible Vertex if there is one.
-1 else.

◆ getNodes()

vector< shared_ptr< Node > > mty::wick::ConnectedComponent::getNodes ( ) const

Allows to get all nodes of the ConnectedComponent independently of their contractions.

Returns
A std::vector of std::shared_ptr to the Nodes of the component.

◆ hasValenceLeft()

bool mty::wick::ConnectedComponent::hasValenceLeft ( ) const

Tells if the ConnectedComponent has contractible Node left.

If no, it means that the component can no longer be contracted. And if there if free Node left in the Graph, the contraction gives 0 in the calculation: only connected Graph are considered in Wick contraction.

Returns
True if the component has free Node left.
False else.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  fout,
const ConnectedComponent c 
)
friend

Overload of operator<< for ConnectedComponent.

Parameters
foutOutput stream.
cConnectedComponent to display.
Returns
The modified stream.

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