Implements Whitehead Simple graph (i.e. no multiple edges or loops allowed). More...
#include <WhiteheadGraph.h>
Public Member Functions | |
WhiteheadSimpleGraph (const Word &w, int num_of_gens) | |
Constructor. | |
~WhiteheadSimpleGraph () | |
int | getCount (int i, int j) const |
Get the label of the edge (i,j). | |
int | getSize () const |
Get the number of vertices of the graph. | |
vector< double > | getWeightVector () const |
Get a vector containing weights of the edges of the graph. | |
vector< Word > | getWeightNames () const |
Get a vector of words, corresponding to edges of the graph. | |
bool | isUndirected () const |
Check if undirected graph. | |
void | makeUndirected () |
Convert to undirected Whitehead graph. | |
int | numberOfComponents () const |
Get the number of connected components. | |
int | numberOfCutVertices () const |
Get the number of cut vertices (articulation points). | |
vector< int > | cutVertices () const |
Get the list of cut vertices (articulation points). | |
int | numberOfCutVerticesBruteForce () const |
vector< int > | cutVerticesBruteForce () const |
Private Member Functions | |
void | printOn (ostream &out) const |
Outputs the graph into a stream. | |
int | genToIndex (const Generator &g) const |
Transfers a letter into a graph vertex. | |
Generator | indToGenerator (int i) const |
Transfers a vertex into the corresponding letter. | |
int | nOfComponents () const |
computes the number of connected components | |
Private Attributes | |
int | theSize |
The number of vertices. | |
int ** | theAdjMatrix |
The adjacensy matrix of the graph. | |
bool | undirected |
True if undirected. | |
Friends | |
ostream & | operator<< (ostream &out, const WhiteheadSimpleGraph &g) |
Output operator. |
Implements Whitehead Simple graph (i.e. no multiple edges or loops allowed).
Definition at line 155 of file WhiteheadGraph.h.
WhiteheadSimpleGraph::WhiteheadSimpleGraph | ( | const Word & | w, | |
int | num_of_gens | |||
) |
Constructor.
w | - input word. | |
num_of_gen | - the number of generators in the corresponding group |
WhiteheadSimpleGraph::~WhiteheadSimpleGraph | ( | ) |
vector<int> WhiteheadSimpleGraph::cutVertices | ( | ) | const |
Get the list of cut vertices (articulation points).
vector<int> WhiteheadSimpleGraph::cutVerticesBruteForce | ( | ) | const |
int WhiteheadSimpleGraph::genToIndex | ( | const Generator & | g | ) | const [inline, private] |
Transfers a letter into a graph vertex.
Definition at line 246 of file WhiteheadGraph.h.
References WhiteheadGraph::nOfGenerators.
int WhiteheadSimpleGraph::getCount | ( | int | i, | |
int | j | |||
) | const [inline] |
Get the label of the edge (i,j).
The label is the number of times (counts) the subword occurred in w.
i | - first vertex (letter) | |
j | - second vertex (letter) |
Definition at line 180 of file WhiteheadGraph.h.
References msgs::error(), theAdjMatrix, and theSize.
int WhiteheadSimpleGraph::getSize | ( | ) | const [inline] |
Get the number of vertices of the graph.
Definition at line 190 of file WhiteheadGraph.h.
References theSize.
vector<Word> WhiteheadSimpleGraph::getWeightNames | ( | ) | const |
Get a vector of words, corresponding to edges of the graph.
vector<double> WhiteheadSimpleGraph::getWeightVector | ( | ) | const |
Get a vector containing weights of the edges of the graph.
Generator WhiteheadSimpleGraph::indToGenerator | ( | int | i | ) | const [inline, private] |
Transfers a vertex into the corresponding letter.
Definition at line 255 of file WhiteheadGraph.h.
References WhiteheadGraph::nOfGenerators.
bool WhiteheadSimpleGraph::isUndirected | ( | ) | const [inline] |
Check if undirected graph.
By default the graph is undirected Whitehead graph. Run makeUndirected() to convert to undirected graph.
true
if the graph is undirected Whitehead graph, false
otherwise. Definition at line 210 of file WhiteheadGraph.h.
References undirected.
void WhiteheadSimpleGraph::makeUndirected | ( | ) |
Convert to undirected Whitehead graph.
Initially a Directed Whitehead graph is constructed. Use this function to convert to undirected Whitehead graph.
Edges are added, and the new edge weights , where are the weights in the directed graph.
int WhiteheadSimpleGraph::nOfComponents | ( | ) | const [private] |
computes the number of connected components
int WhiteheadSimpleGraph::numberOfComponents | ( | ) | const |
Get the number of connected components.
int WhiteheadSimpleGraph::numberOfCutVertices | ( | ) | const |
Get the number of cut vertices (articulation points).
int WhiteheadSimpleGraph::numberOfCutVerticesBruteForce | ( | ) | const |
void WhiteheadSimpleGraph::printOn | ( | ostream & | out | ) | const [private] |
Outputs the graph into a stream.
ostream& operator<< | ( | ostream & | out, | |
const WhiteheadSimpleGraph & | g | |||
) | [friend] |
Output operator.
Definition at line 167 of file WhiteheadGraph.h.
int** WhiteheadSimpleGraph::theAdjMatrix [private] |
The adjacensy matrix of the graph.
Definition at line 272 of file WhiteheadGraph.h.
Referenced by getCount().
int WhiteheadSimpleGraph::theSize [private] |
The number of vertices.
Definition at line 269 of file WhiteheadGraph.h.
Referenced by getCount(), and getSize().
bool WhiteheadSimpleGraph::undirected [private] |