public final class HighCapacityDagLevel extends java.lang.Object implements DagLevel
Class HighCapacityDagLevel
represents a level of a leveled
directed acyclic graph (DAG) that can contain up to
Integer.MAX_VALUE
edges.
Instances of HighCapacityDagLevel
are immutable.
Constructor and Description |
---|
HighCapacityDagLevel(int[] parentNodes,
int[] childNodes,
int[] symbols,
float[] counts)
Constructs a new
HighCapacityDagLevel instance from the
specified data. |
Modifier and Type | Method and Description |
---|---|
int |
childNode(int edge)
Returns the index of the child node of the specified edge
at this level of the DAG.
|
float |
condEdgeProb(int edge)
Returns the conditional edge probability, which is defined to be
the ratio of the sum of the weights of the sequences that pass
through the specified edge at this level of the DAG and
the sum of the weights of the sequences that pass through the parent
node of the specified edge.
|
float |
edgeProb(int edge)
Returns the edge probability, which is defined to be the ratio of the
sum of the weights of the sequences that pass through the specified
edge at this level of the DAG and the sum of the weights of the
sequences that pass through any edge at this level of the DAG.
|
float |
edgeWeight(int edge)
Returns the sum of weights for the sequences that pass
through the specified edge at this level of the DAG.
|
int |
inEdge(int childNode,
int inEdgeIndex)
Returns the index of the specified edge at this level of the DAG.
|
int |
nChildNodes()
Returns the number of child nodes at this level of the DAG.
|
int |
nEdges()
Returns the number of edges at this level of the DAG.
|
int |
nInEdges(int childNode)
Returns the number of ingoing edges for the specified child node
at this level of the DAG.
|
int |
nOutEdges(int parentNode)
Returns the number of outgoing edges of the specified parent node
at this level of the DAG.
|
int |
nParentNodes()
Returns the number of parent nodes at this level of the DAG.
|
int |
outEdge(int parentNode,
int outEdgeIndex)
Returns the index of the specified edge at this level of the DAG.
|
int |
outEdgeBySymbol(int parentNode,
int symbol)
Returns the index of the specified edge at this level of the
DAG or
-1 if no such edge exists. |
int |
parentNode(int edge)
Returns the index of the parent node of the specified edge
at this level of the DAG.
|
float |
parentProb(int node)
Returns the parent node probability, which is defined to be the
ratio of the sum of the weights of the sequences that pass through
the specified parent node at this level of the DAG and the sum of
the weights of the sequences that pass through any parent node at this
level of the DAG.
|
float |
parentWeight(int parentNode)
Returns the sum of weights for the sequences that pass
through the specified node at this level of the DAG.
|
int |
symbol(int edge)
Returns the symbol labeling the specified edge at this level
of the DAG.
|
java.lang.String |
toString()
Returns a string representation of
this . |
public HighCapacityDagLevel(int[] parentNodes, int[] childNodes, int[] symbols, float[] counts)
HighCapacityDagLevel
instance from the
specified data.parentNodes
- an array mapping edge index to parent node indexchildNodes
- an array mapping edge index to child node indexsymbols
- an array mapping edge index to the symbol labeling the
edgecounts
- an array mapping edge index to edge countjava.lang.IllegalArgumentException
- if the specified arrays do not all
have the same lengthjava.lang.IllegalArgumentException
- if any element of the symbols array
is negativejava.lang.IllegalArgumentException
- if any two edges have the same
parent node and are both labeled with the same symboljava.lang.IllegalArgumentException
- if the set of values of the
parentNodes
array is not equal to {0, 1, 2, ..., k}
for
some k
java.lang.IllegalArgumentException
- if the set of values of the
childNodes
array is not equal to {0, 1, 2, ..., k}
for some k
java.lang.NullPointerException
- if any parameter is null
public int nEdges()
DagLevel
public int nParentNodes()
DagLevel
nParentNodes
in interface DagLevel
public int nChildNodes()
DagLevel
nChildNodes
in interface DagLevel
public int parentNode(int edge)
DagLevel
parentNode
in interface DagLevel
edge
- an edge indexpublic int childNode(int edge)
DagLevel
public int symbol(int edge)
DagLevel
public float edgeWeight(int edge)
DagLevel
edgeWeight
in interface DagLevel
edge
- an edge indexpublic float parentWeight(int parentNode)
DagLevel
parentWeight
in interface DagLevel
parentNode
- a parent node indexpublic float condEdgeProb(int edge)
DagLevel
condEdgeProb
in interface DagLevel
edge
- an edge indexpublic float edgeProb(int edge)
DagLevel
public float parentProb(int node)
DagLevel
parentProb
in interface DagLevel
node
- a parent node indexpublic int nOutEdges(int parentNode)
DagLevel
public int outEdge(int parentNode, int outEdgeIndex)
DagLevel
public int outEdgeBySymbol(int parentNode, int symbol)
DagLevel
-1
if no such edge exists.outEdgeBySymbol
in interface DagLevel
parentNode
- a parent node indexsymbol
- a symbol labeling an outgoing edge of the specified
parent node-1
if no such edge existspublic int nInEdges(int childNode)
DagLevel
public int inEdge(int childNode, int inEdgeIndex)
DagLevel
public java.lang.String toString()
DagLevel
this
. The exact
details of the representation are unspecified and subject to change.