Biorithm
1.1
|
#include <dag.h>
Public Member Functions | |
DAG () | |
DAG (const DAG< NodeType > &rhs) | |
DAG (istream *in) | |
virtual | ~DAG () |
const DAG< NodeType > & | operator= (const DAG &rhs) |
void | clear () |
virtual void | addNode (NodeType *node) |
void | computeDifference (DAG< NodeType > &other, DAG< NodeType > &difference) |
virtual void | computePower (unsigned int exponent, DAG< NodeType > &powerDAG) |
virtual void | computeLeaves (vector< NodeType * > &leaves, unsigned int type=0) |
virtual void | computeRoots (vector< NodeType * > &roots, unsigned int type=0) |
virtual void | computeTopologicalSort (vector< NodeType * > &sortedFunctions, unsigned int type=0) |
virtual void | computeTransitiveClosure (DAG< NodeType > &closedDAG) |
virtual void | computeTransitiveReduction (DAG< NodeType > &reducedDAG) |
unsigned int | getNumEdges () const |
unsigned int | getNumNodes () const |
void | print (string file) const |
void | print (ostream &ostr) const |
DAG () | |
DAG (const DAG< NodeType > &rhs) | |
DAG (istream *in) | |
virtual | ~DAG () |
const DAG< NodeType > & | operator= (const DAG &rhs) |
void | clear () |
virtual void | addNode (NodeType *node) |
void | computeDifference (DAG< NodeType > &other, DAG< NodeType > &difference) |
virtual void | computePower (unsigned int exponent, DAG< NodeType > &powerDAG) |
virtual void | computeLeaves (vector< NodeType * > &leaves, unsigned int type=0) |
virtual void | computeRoots (vector< NodeType * > &roots, unsigned int type=0) |
virtual void | computeTopologicalSort (vector< NodeType * > &sortedFunctions, unsigned int type=0) |
virtual void | computeTransitiveClosure (DAG< NodeType > &closedDAG) |
virtual void | computeTransitiveReduction (DAG< NodeType > &reducedDAG) |
unsigned int | getNumEdges () const |
unsigned int | getNumNodes () const |
void | print (string file) const |
void | print (ostream &ostr) const |
Protected Member Functions | |
void | _copy (const DAG< NodeType > &rhs) |
void | _copyNodes (const DAG< NodeType > &rhs) |
unsigned int | _getNodeIndex (const NodeType *node) const |
void | _copy (const DAG< NodeType > &rhs) |
void | _copyNodes (const DAG< NodeType > &rhs) |
unsigned int | _getNodeIndex (const NodeType *node) const |
Protected Attributes | |
vector< NodeType * > | _nodes |
map< const NodeType *, unsigned int > | _nodesToIndices |
A class that encapsulates a Directed Acyclic Graph. NodeType is a class that stores information for a particular node. In a particular instantiation of DAG, NodeType should be a subclass of DAGNode.
Copy constructor
Constructor
*in | A stream pointer (eg: &cout, &infile, &myStringStream) |
Copy constructor
Constructor
*in | A stream pointer (eg: &cout, &infile, &myStringStream) |
void DAG< NodeType >::computeDifference | ( | DAG< NodeType > & | other, |
DAG< NodeType > & | difference | ||
) |
Adds a node to the DAG.
[in] | other,an | instance of DAG< NodeType > |
[out] | difference,an | instance of DAG< NodeType > that will hold the difference between the invocant and other. |
The method adds those parent-child relations to difference that are in the invocant but not in other.
void DAG< NodeType >::computeDifference | ( | DAG< NodeType > & | other, |
DAG< NodeType > & | difference | ||
) |
Adds a node to the DAG.
[in] | other,an | instance of DAG< NodeType > |
[out] | difference,an | instance of DAG< NodeType > that will hold the difference between the invocant and other. |
The method adds those parent-child relations to difference that are in the invocant but not in other.
void DAG< NodeType >::computeLeaves | ( | vector< NodeType * > & | leaves, |
unsigned int | type = 0 |
||
) | [virtual] |
Compute the leaves of the DAG, i.e., nodes without any children.
virtual void DAG< NodeType >::computeLeaves | ( | vector< NodeType * > & | leaves, |
unsigned int | type = 0 |
||
) | [virtual] |
Compute the leaves of the DAG, i.e., nodes without any children.
void DAG< NodeType >::computePower | ( | unsigned int | exponent, |
DAG< NodeType > & | powerDAG | ||
) | [virtual] |
Computes the kth power of the DAG.
[in] | exponent,the | value of the power to compute. |
[out] | powerDAG,an | instance of DAG< NodeType > that will contain the power. |
The kth power of a DAG is another DAG that contains an edge between nodes a and b if the there is a path of length k between the nodes in the original DAG. For example, the first power of a DAG is the DAG itself and the second power of a DAG connects each node to all its grandparents in the original DAG. The union of all powers of a DAG is the transitive closure of the DAG.
virtual void DAG< NodeType >::computePower | ( | unsigned int | exponent, |
DAG< NodeType > & | powerDAG | ||
) | [virtual] |
Computes the kth power of the DAG.
[in] | exponent,the | value of the power to compute. |
[out] | powerDAG,an | instance of DAG< NodeType > that will contain the power. |
The kth power of a DAG is another DAG that contains an edge between nodes a and b if the there is a path of length k between the nodes in the original DAG. For example, the first power of a DAG is the DAG itself and the second power of a DAG connects each node to all its grandparents in the original DAG. The union of all powers of a DAG is the transitive closure of the DAG.
void DAG< NodeType >::computeRoots | ( | vector< NodeType * > & | roots, |
unsigned int | type = 0 |
||
) | [virtual] |
Compute the roots of the DAG, i.e., nodes without any parents.
virtual void DAG< NodeType >::computeRoots | ( | vector< NodeType * > & | roots, |
unsigned int | type = 0 |
||
) | [virtual] |
Compute the roots of the DAG, i.e., nodes without any parents.
void DAG< NodeType >::computeTopologicalSort | ( | vector< NodeType * > & | sortedFunctions, |
unsigned int | type = 0 |
||
) | [virtual] |
Performs a topological sort of the functions in the DAG from the root downward.
The nodes in each connected component of the DAG appear consecutively in the sorted order.
sortedFunction,a | reference to a vector of pointers to instance of NodeType. The method fills this vector with the sorted list of functions. |
type,an | integer defining what type of relations to use when performing the topological sort. |
virtual void DAG< NodeType >::computeTopologicalSort | ( | vector< NodeType * > & | sortedFunctions, |
unsigned int | type = 0 |
||
) | [virtual] |
Performs a topological sort of the functions in the DAG from the root downward.
The nodes in each connected component of the DAG appear consecutively in the sorted order.
sortedFunction,a | reference to a vector of pointers to instance of NodeType. The method fills this vector with the sorted list of functions. |
type,an | integer defining what type of relations to use when performing the topological sort. |
void DAG< NodeType >::computeTransitiveClosure | ( | DAG< NodeType > & | closedDAG | ) | [virtual] |
Compute the transitive closure of the DAG.
[out] | closedDAG,the | computed transitive closure. |
For every pair of nodes a and b in the invocant such that b is an ancestor of a, the methods adds b as a parent of a in the transitive closure.
virtual void DAG< NodeType >::computeTransitiveClosure | ( | DAG< NodeType > & | closedDAG | ) | [virtual] |
Compute the transitive closure of the DAG.
[out] | closedDAG,the | computed transitive closure. |
For every pair of nodes a and b in the invocant such that b is an ancestor of a, the methods adds b as a parent of a in the transitive closure.
void DAG< NodeType >::computeTransitiveReduction | ( | DAG< NodeType > & | reducedDAG | ) | [virtual] |
Compute the transitive reduction of the DAG.
[out] | reducedDAG,the | computed transitive reduction. |
For every pair of nodes a and b in the invocant such that b is a parent of a, the methods ensures that b is an ancestor of a in the transitive reduction. The method includes all edges in the invocant in the reduction that are not edges in the square of the invocant.
virtual void DAG< NodeType >::computeTransitiveReduction | ( | DAG< NodeType > & | reducedDAG | ) | [virtual] |
Compute the transitive reduction of the DAG.
[out] | reducedDAG,the | computed transitive reduction. |
For every pair of nodes a and b in the invocant such that b is a parent of a, the methods ensures that b is an ancestor of a in the transitive reduction. The method includes all edges in the invocant in the reduction that are not edges in the square of the invocant.
unsigned int DAG< NodeType >::getNumEdges | ( | ) | const |
Reads information about the Gene Ontology.
file | A string containing the location of a file. Reads information about the DAG. |
*in | A stream pointer (eg: &cout, &infile, &myStringStream) Performs a transitive closure traversal of the DAG to determine the ancestors of each node. |
Partial traversals are cached making this a constant time operation when repeated and fast if some of the ancestors have already been computed
obj | A gene ontology function object pointer |
type | an integer defining what type of traversal will be done:
|
Returns a node's direct parents
obj | A pointer to an instance of NodeType. |
type | an integer defining what type of parents to return:
|
Performs a transitive closure traversal of the DAG to determine the descendants of each function.
Partial traversals are cached making this a constant time operation when repeated and fast if some of the descendants have already been computed.
obj | A pointer to an instance of NodeType. |
type | an integer defining what type of traversal will be done:
|
Returns a node's direct children
obj | A pointer to an instance of NodeType. |
type | an integer defining what type of children to return:
|
Constant time lookup of function by id (or alternative id)
id | The id to lookup |
id | The id to lookup. This id is a string. |
The method converts id to an integer to removing any prefix of the form "GO:" Return the number of edges (parent-child relationships) in the DAG.
unsigned int DAG< NodeType >::getNumEdges | ( | ) | const |
Reads information about the Gene Ontology.
file | A string containing the location of a file. Reads information about the DAG. |
*in | A stream pointer (eg: &cout, &infile, &myStringStream) Performs a transitive closure traversal of the DAG to determine the ancestors of each node. |
Partial traversals are cached making this a constant time operation when repeated and fast if some of the ancestors have already been computed
obj | A gene ontology function object pointer |
type | an integer defining what type of traversal will be done:
|
Returns a node's direct parents
obj | A pointer to an instance of NodeType. |
type | an integer defining what type of parents to return:
|
Performs a transitive closure traversal of the DAG to determine the descendants of each function.
Partial traversals are cached making this a constant time operation when repeated and fast if some of the descendants have already been computed.
obj | A pointer to an instance of NodeType. |
type | an integer defining what type of traversal will be done:
|
Returns a node's direct children
obj | A pointer to an instance of NodeType. |
type | an integer defining what type of children to return:
|
Constant time lookup of function by id (or alternative id)
id | The id to lookup |
id | The id to lookup. This id is a string. |
The method converts id to an integer to removing any prefix of the form "GO:" Return the number of edges (parent-child relationships) in the DAG.
unsigned int DAG< NodeType >::getNumNodes | ( | ) | const |
Return the number of nodes in the DAG.
unsigned int DAG< NodeType >::getNumNodes | ( | ) | const |
Return the number of nodes in the DAG.
const DAG< NodeType >& DAG< NodeType >::operator= | ( | const DAG< NodeType > & | rhs | ) | [inline] |
Assignment operator
const DAG< NodeType >& DAG< NodeType >::operator= | ( | const DAG< NodeType > & | rhs | ) | [inline] |
Assignment operator