MinLCA algorithms
Classes | Enumerations | Functions
minlca::utils Namespace Reference

Namespace for util functions and classes. More...

Classes

class  BinomialRandom
 Class defining binomial random graphs. More...
 
class  CliqueCycle
 Class describing a cycle of cliques. More...
 
class  CliqueGraph
 Class describing a random graph with cliques. More...
 
class  CliqueSet
 Class describing a set of non-adjacent cliques. More...
 
class  RandomGeometric
 Class defining random geometric graphs. More...
 
class  RandomGraph
 Base class for random graph generators. More...
 
class  RandomOuterplanar
 Class defining random geometric graphs. More...
 
class  SimulatedAnnealing
 Generic simulated annealing algorithm. More...
 
class  Timer
 Simple timing class. More...
 

Enumerations

enum  GraphFormat { RMF, GRA }
 Available graph formats.
 

Functions

template<typename IS , typename Graph >
void readGraphRmfRandomOrder (Graph &g, int seed, IS &in)
 Read a graph in RMF format. More...
 
template<typename IS , typename Graph >
void readGraphGraRandomOrder (Graph &g, int seed, IS &in)
 Read a graph in GRA format. More...
 
template<typename IS = std::istream, typename Graph = lemon::SmartGraph>
void readGraphRandomOrder (Graph &g, int seed=0, GraphFormat f=RMF, IS &in=std::cin)
 Read a graph in random order. More...
 
template<typename IS = std::istream, typename Graph = lemon::SmartGraph>
void readGraph (Graph &g, GraphFormat f=RMF, IS &in=std::cin)
 Read a graph. More...
 
template<typename Graph >
int degree (const Graph &g, const typename Graph::Node &v)
 Degree of a vertex. More...
 
template<typename Graph >
int maxDegree (const Graph &g)
 Maximum degree of a graph. More...
 
template<typename T >
int posMax (const std::vector< T > &v)
 Index of the maximum position. More...
 
std::vector< int > nonNegative (const std::vector< int > &v)
 Vector of non-negative indices. More...
 

Detailed Description

Namespace for util functions and classes.

Namespace for functions and classes which are not strictly related to the MinLCA problem.

Function Documentation

template<typename Graph >
int minlca::utils::degree ( const Graph &  g,
const typename Graph::Node &  v 
)
inline

Degree of a vertex.

Parameters
gGraph
vVertex in the graph

Definition at line 171 of file graph_utils.hh.

template<typename Graph >
int minlca::utils::maxDegree ( const Graph &  g)
inline

Maximum degree of a graph.

Parameters
gGraph

Definition at line 181 of file graph_utils.hh.

std::vector<int> minlca::utils::nonNegative ( const std::vector< int > &  v)
inline

Vector of non-negative indices.

Returns
A vector with the indices of non-negative value in the given vector

Definition at line 33 of file utils.hh.

template<typename T >
int minlca::utils::posMax ( const std::vector< T > &  v)
inline

Index of the maximum position.

Returns
The index of the maximum position in the given vector. If there is more than one, returns the index of the first appearance.

Definition at line 25 of file utils.hh.

template<typename IS = std::istream, typename Graph = lemon::SmartGraph>
void minlca::utils::readGraph ( Graph &  g,
GraphFormat  f = RMF,
IS &  in = std::cin 
)

Read a graph.

Reads a graph. Equivalent to readGraphRandomOrder(g, 0, f, in)

See also
readGraphRandomOrder(Graph &, int, GraphFormat, IS&)
readGraphRmfRandomOrder(Graph &, int, IS&)
readGraphGraRandomOrder(Graph &, int, IS&)
Parameters
gGraph where to save the input
fGraph format
inInput stream

Definition at line 160 of file graph_utils.hh.

template<typename IS , typename Graph >
void minlca::utils::readGraphGraRandomOrder ( Graph &  g,
int  seed,
IS &  in 
)

Read a graph in GRA format.

Reads a graph in GRA format and allows randomising the order of adding the vertices to the data structure. When the seed is 0, vertex order is not randomised

Parameters
gGraph where to save the input
seedRandom seed to order the vertices
inInput stream

Definition at line 77 of file graph_utils.hh.

template<typename IS = std::istream, typename Graph = lemon::SmartGraph>
void minlca::utils::readGraphRandomOrder ( Graph &  g,
int  seed = 0,
GraphFormat  f = RMF,
IS &  in = std::cin 
)

Read a graph in random order.

Reads a graph and allows randomising the order of adding the vertices to the data structure. When the seed is 0, vertex order is not randomised

See also
readGraphRmfRandomOrder(Graph &, int, IS&)
readGraphGraRandomOrder(Graph &, int, IS&)
Parameters
gGraph where to save the input
seedRandom seed to order the vertices
fGraph format
inInput stream

Definition at line 131 of file graph_utils.hh.

template<typename IS , typename Graph >
void minlca::utils::readGraphRmfRandomOrder ( Graph &  g,
int  seed,
IS &  in 
)

Read a graph in RMF format.

Reads a graph in RMF format and allows randomising the order of adding the vertices to the data structure. When the seed is 0, vertex order is not randomised

Parameters
gGraph where to save the input
seedRandom seed to order the vertices
inInput stream

Definition at line 31 of file graph_utils.hh.