Constructor and Description |
---|
ImmutableDag(Markers markers,
DagLevel[] levels)
Constructs a new
ImmutableDag instance from the specified data. |
Modifier and Type | Method and Description |
---|---|
int |
childNode(int level,
int edge)
Returns the index of the specified child node in the DAG.
|
float |
condEdgeProb(int level,
int edge)
Returns the ratio of the sum of the weights of the sequences that pass
through the specified edge of the DAG and
the sum of the weights of the sequences that pass through the parent
node of the specified edge of the DAG.
|
float |
edgeProb(int level,
int edge)
Returns the ratio of the sum of the weights of the sequences that pass
through the specified edge of the DAG and the sum of the weights of all
sequences.
|
float |
edgeWeight(int level,
int edge)
Returns the sum of the weights of the sequences that pass
through the specified edge of the DAG.
|
int |
inEdge(int level,
int childNode,
int inEdge)
Returns the index of the specified edge in the DAG.
|
boolean |
isChildOf(int parentLevel,
int parentEdge,
int childEdge)
Returns
true if the child node of the specified parent
edge equals the parent node of the specified child edge and
returns false otherwise. |
Markers |
markers()
Returns the markers represented by this DAG.
|
int |
maxEdges()
Returns the maximum number of edges at any level of the DAG.
|
int |
maxNodes()
Returns the maximum number of parent nodes at any level of the DAG.
|
int |
nChildNodes(int level)
Returns the number of child nodes at the specified level of the DAG.
|
long |
nEdges()
Returns the number of edges in the DAG.
|
int |
nEdges(int level)
Returns the number of edges at the specified level of the DAG.
|
int |
nInEdges(int level,
int childNode)
Returns the number of ingoing edges for the specified node of the DAG.
|
int |
nLevels()
Returns the number of markers.
|
long |
nNodes()
Returns the number of nodes in the DAG.
|
int |
nOutEdges(int level,
int parentNode)
Returns the number of outgoing edges for the specified node of the DAG.
|
int |
nParentNodes(int level)
Returns the number of parent nodes at the specified level of the DAG.
|
int |
outEdge(int level,
int parentNode,
int outEdge)
Returns the index of the specified edge in the DAG.
|
int |
outEdgeBySymbol(int level,
int parentNode,
int symbol)
Returns the index of the specified edge at the specified level of the
DAG or
-1 if no such edge exists. |
int |
parentNode(int level,
int edge)
Returns the index of the specified parent node in the DAG.
|
float |
parentProb(int level,
int node)
Returns the ratio of the sum of the weights of the sequences that pass
through the specified parent node of the DAG and the sum of the weights
of all sequences.
|
float |
parentWeight(int level,
int parentNode)
Returns the sum of the weights of the sequences that pass
through the specified node of the DAG.
|
double[] |
posArray()
Returns an array of length
this.nMarkers() whose j -th
element is the distance from the root node to
the child node at level j of the DAG. |
int |
symbol(int level,
int edge)
Returns the symbol labeling the specified edge of the DAG.
|
java.lang.String |
toString()
Returns a string representation of
this . |
java.lang.String |
toString(int startLevel,
int endLevel)
Returns a description of the specified levels of the DAG.
|
public ImmutableDag(Markers markers, DagLevel[] levels)
ImmutableDag
instance from the specified data.markers
- the markerslevels
- the levels of the leveled DAGjava.lang.IllegalArgumentException
- if levels.length == 0
java.lang.IllegalArgumentException
- if levels[0].nParentNodes() != 1
java.lang.IllegalArgumentException
- if
levels[j-1].nChildNodes() != levels[j].nParentNodes()
for any
j
satisfying 0 < j && j < levels.length
java.lang.NullPointerException
- if
(markers == null || levels==null)
, or if
levels[j] == null
for any
j
satisfying 0 <= j && j < levels.length
public int nEdges(int level)
Dag
public int nParentNodes(int level)
Dag
nParentNodes
in interface Dag
level
- a level of the DAGpublic int nChildNodes(int level)
Dag
nChildNodes
in interface Dag
level
- a level of the DAGpublic int parentNode(int level, int edge)
Dag
parentNode
in interface Dag
level
- a level of the DAG.edge
- the index of an edge at the specified level of the DAGpublic int childNode(int level, int edge)
Dag
public int symbol(int level, int edge)
Dag
public float edgeWeight(int level, int edge)
Dag
edgeWeight
in interface Dag
level
- a level of the DAGedge
- the index of an edge at the specified level of the DAGpublic float parentWeight(int level, int parentNode)
Dag
parentWeight
in interface Dag
level
- a level of the DAGparentNode
- the index of a parent node at the specified level
of the DAGpublic float condEdgeProb(int level, int edge)
Dag
condEdgeProb
in interface Dag
level
- a level of the DAGedge
- the index of an edge at the specified level of the DAGpublic float edgeProb(int level, int edge)
Dag
public float parentProb(int level, int node)
Dag
parentProb
in interface Dag
level
- a level of the DAGnode
- the index of a parent node at the specified level
of the DAGpublic int nLevels()
Dag
public Markers markers()
Dag
public long nNodes()
Dag
public long nEdges()
Dag
public int maxNodes()
Dag
public int maxEdges()
Dag
public int nOutEdges(int level, int parentNode)
Dag
public int outEdge(int level, int parentNode, int outEdge)
Dag
public int outEdgeBySymbol(int level, int parentNode, int symbol)
Dag
-1
if no such edge exists.outEdgeBySymbol
in interface Dag
level
- a level of the DAGparentNode
- the index of a parent node at the specified
level of the DAGsymbol
- a symbol labeling an outgoing edge of the specified
parent node of the DAG-1
if no such edge existspublic int nInEdges(int level, int childNode)
Dag
public int inEdge(int level, int childNode, int inEdge)
Dag
public boolean isChildOf(int parentLevel, int parentEdge, int childEdge)
Dag
true
if the child node of the specified parent
edge equals the parent node of the specified child edge and
returns false
otherwise.isChildOf
in interface Dag
parentLevel
- a level of the DAGparentEdge
- the index of an edge at the specified level
of the DAGchildEdge
- the index of an edge at level (parentLevel + 1)
of the DAGtrue
if the child node of the specified parent
edge equals the parent node of the specified child edgepublic double[] posArray()
Dag
this.nMarkers()
whose j
-th
element is the distance from the root node to
the child node at level j
of the DAG.
The distance from parent node to child node at level lev
equals -Math.log10(P)
where P
is the weighted conditional
edge probability at level lev
, when each edge e
is
weighted by this.counts(lev, e)
.public java.lang.String toString(int startLevel, int endLevel)
Dag
public java.lang.String toString()
Dag
this
. The exact
details of the representation are unspecifed and subject to change.