Biorithm  1.1
Public Member Functions | Protected Member Functions | Protected Attributes
AbstractSingleReconciliation Class Reference

This is an abstract class for reconciliation algorithms. More...

#include <reconciliation-algorithms.h>

Inheritance diagram for AbstractSingleReconciliation:
GeneMANIA HeatKernel PageRank SinkSource Vanilla

List of all members.

Public Member Functions

 AbstractSingleReconciliation (MyGraph &graph, MyPointSet &weights, double q, double maxIters, double epsilon, string outputPrefix)
 AbstractSingleReconciliation (vector< MyGraph > &graphs, double q, double maxIters, double epsilon, string outputPrefix)
virtual ~AbstractSingleReconciliation ()
 Destructor.
virtual string getName ()
 Return the name of the algorithm.
virtual void run ()
 Run the algorithm on each sample in _weights.
void setCurrGraphA (MyGraph &g)
void setCurrSampleA (unsigned int n)

Protected Member Functions

virtual void _initialiseNodeWeights (map< MyNodeId, double > &initial, map< MyNodeId, double > &current, map< MyNodeId, double > &previous, MyGraph &graph, const MyPointSet &weights, unsigned int sample, bool normalize=true)
 Initialize the node weights for the given sample.
virtual void _initialiseNodeWeights (map< MyNodeId, double > &initial, map< MyNodeId, double > &current, map< MyNodeId, double > &previous, MyGraph &graph)
 Initialize each node's weight to 1/N, where N is the number of nodes in the graph.
virtual void _initialiseNodeWeights (map< MyNodeId, double > &initial, map< MyNodeId, double > &current, map< MyNodeId, double > &previous, MyGraph &graph, double val)
 Initialize each node's weight to the given value.
virtual void _runAlgorithmOnceA ()
 Run the algorithm once for the current sample.
virtual bool _checkFinished (unsigned int iters, double maxDiff)
 Check if we have reached convergence criteria. Return true if converged, false otherwise.
virtual void _updateNodeWeightA (MyNode node)=0
 This virtual method is unique for each reconciliation algorithm.
virtual void _printNodeWeights (ofstream &ostr)
 Pretty print the node weights to _outputStream.
virtual void _runForWeights ()
 Run the reconciliation algorithm for the case where a single network and one or more samples of node weights are provided.
virtual void _runForGraphs ()
 Run the reconciliation algorithm for the case where multiple networks are provided.
virtual pair< double, double > _computeEnergy ()
 A method to compute the node summation and edge summation in the energy functions for each algorithm.

Protected Attributes

vector< MyGraph_graphs
 The set of graphs on which this algorithm will be run.
MyGraph _currGraphA
 The current graph on which the algorithm is operating.
MyPointSet _weights
 The matrix of node weights, which may contain multiple samples.
double _q
 The parameter q used by many of the reconciliation algorithm to balance network influence with initial node weights.
unsigned int _MAX_ITERS
 The maximum number of iterations to run the iterative reconciliation algorithms.
double _EPSILON
 A small value used to determine when the reconciliation algorithm has converged.
unsigned int _currSampleA
 The index of the current sample on which the algorithm is operating.
string _outputPrefix
 The string to preprend to all generated output files.
map< MyNodeId, double > _initialNodeWeightsA
 The initial node weights for the current run of the reconciliation algorithm.
map< MyNodeId, double > _currNodeWeightsA
 The node weights in the current run of the reconciliation algorithm.
map< MyNodeId, double > _prevNodeWeightsA
 The node weights in the previous run of the reconciliation algorithm.

Detailed Description

This is an abstract class for reconciliation algorithms.

This abstract base class serves as a skeleton to provide methods that each reconciliation algorithm must implement.


Constructor & Destructor Documentation

AbstractSingleReconciliation::AbstractSingleReconciliation ( MyGraph graph,
MyPointSet weights,
double  q,
double  maxIters,
double  epsilon,
string  outputPrefix 
) [inline]

Constructor for running the algorithm on a single network with multiple initial weights samples.

Parameters:
[in]graphThe network on which to operate.
[in]weightsThe samples containing initial node weights.
[in]qThe parameter q used by the algorithm.
[in]maxItersThe maximum number of iterations to run the iterative reconciliation algorithms.
[in]epsilonA small value that defines part of the convergence criteria.
[in]outputPrefixA string to prepend to all output files.
AbstractSingleReconciliation::AbstractSingleReconciliation ( vector< MyGraph > &  graphs,
double  q,
double  maxIters,
double  epsilon,
string  outputPrefix 
) [inline]

Constructor for running the algorithm on multiple networks with no initial weights.

Parameters:
[in]graphsThe networks on which to operate.
[in]qThe parameter q used by the algorithm.
[in]maxItersThe maximum number of iterations to run the iterative reconciliation algorithms.
[in]epsilonA small value that defines part of the convergence criteria.
[in]outputPrefixA string to prepend to all output files.

Member Function Documentation

bool AbstractSingleReconciliation::_checkFinished ( unsigned int  iters,
double  maxDiff 
) [protected, virtual]

Check if we have reached convergence criteria. Return true if converged, false otherwise.

Parameters:
[in]itersCurrent number of iterations that have elapsed. If this value is greater than or equal to MAX_ITERS, return true.
[in]maxDiffThe maximum difference of any node's value between the current iteration and previous iteration. If this value is smaller than _EPSILON, return true.

Reimplemented in HeatKernel.

void AbstractSingleReconciliation::_initialiseNodeWeights ( map< MyNodeId, double > &  initial,
map< MyNodeId, double > &  current,
map< MyNodeId, double > &  previous,
MyGraph graph,
const MyPointSet weights,
unsigned int  sample,
bool  normalize = true 
) [protected, virtual]

Initialize the node weights for the given sample.

Parameters:
[out]intitialThe data structure to hold initial node weights.
[out]currentThe data structure to hold current node weights.
[out]previousThe data structure to hold previous node weights.
[in]graphThe network on which we will run the reconciliation algorithm.
[in]weightsThe instance of MyPointSet containing the node weights.
[in]sampleAn index to the sample to use for the node weights.
[in]normalizeA boolean that specifies whether to normalize the initial node weights to sum to 1.
void AbstractSingleReconciliation::_initialiseNodeWeights ( map< MyNodeId, double > &  initial,
map< MyNodeId, double > &  current,
map< MyNodeId, double > &  previous,
MyGraph graph 
) [protected, virtual]

Initialize each node's weight to 1/N, where N is the number of nodes in the graph.

Parameters:
[out]intitialThe data structure to hold initial node weights.
[out]currentThe data structure to hold current node weights.
[out]previousThe data structure to hold previous node weights.
[in]graphThe network on which we will run the reconciliation algorithm.
void AbstractSingleReconciliation::_initialiseNodeWeights ( map< MyNodeId, double > &  initial,
map< MyNodeId, double > &  current,
map< MyNodeId, double > &  previous,
MyGraph graph,
double  val 
) [protected, virtual]

Initialize each node's weight to the given value.

Parameters:
[out]intitialThe data structure to hold initial node weights.
[out]currentThe data structure to hold current node weights.
[out]previousThe data structure to hold previous node weights.
[in]graphThe network on which we will run the reconciliation algorithm.
[in]valThe value for every node's initial weight.

Set the current sraph

Parameters:
[in]gThe graph to set _currGraphA to.
void AbstractSingleReconciliation::setCurrSampleA ( unsigned int  n) [inline]

Set the current sample.

Parameters:
[in]nThe index of the current sample.

The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs Friends