public class DAG extends Object
| Constructor and Description |
|---|
DAG() |
| Modifier and Type | Method and Description |
|---|---|
static int[] |
computeMaximalHP(Tensor score)
The method computes the HP(k) (see
DAG). |
static int[][] |
computeMaximalKDAG(Tensor score)
Computes the maximal k-DAG (see
DAG), i.e. |
protected static int[][] |
computeMaxKDAG(SymmetricTensor score)
Computes the maximal k-DAG (see
DAG), i.e. |
static int[] |
enumerateHP(Tensor score)
The method computes the HP(k) (see
DAG). |
static double |
getScore(Tensor t,
int[][] structure)
Returns the score for any graph.
|
static double |
getScoreForPath(Tensor score,
int l,
byte k,
int[] path)
Returns the score for a given path
path using the first
l nodes and dependencies of order k. |
static int[][] |
getStructureFromPath(int[] path,
Tensor score)
Extracts the structure from a given path
path and
score-"function". |
static String |
toDirectedGraphvizFormat(int[][] structure)
This method returns a directed
String representation of the
structure that can be used in Graphviz to create an image. |
protected static String |
toGraphvizFormat(int[][] structure,
String arrow)
This method returns a
String representation of the structure that
can be used in Graphviz to create an image. |
static String |
toUndirectedGraphvizFormat(int[][] structure)
This method returns an undirected
String representation of the
structure that can be used in Graphviz to create an image. |
static String |
toWeightedGraphvizFormat(int[][] structure,
String arrow,
Tensor t)
This method returns a
String representation of the weighted
structure that can be used in Graphviz to create an image. |
public static int[] computeMaximalHP(Tensor score)
DAG). Be aware of the memory
(O(2^L * L^k)) and time consumption.score - the Tensor for the edge weightsTensor,
getStructureFromPath(int[], Tensor)public static int[][] computeMaximalKDAG(Tensor score)
protected static int[][] computeMaxKDAG(SymmetricTensor score)
DAG), i.e. the k-DAG that
maximizes the score given by a SymmetricTensor.
score - the SymmetricTensor of the score valuesSymmetricTensorpublic static int[] enumerateHP(Tensor score)
DAG). It tries to enumerate
all permutations and returns the best. This is only possible for a small
number of nodes (<=10).score - the Tensor for the edge weightsgetStructureFromPath(int[], Tensor)public static double getScore(Tensor t, int[][] structure) throws IllegalArgumentException
t - the Tensor for the edge weightsstructure - the graph (encoded as:
(structure[i][0],...,structure[i][structure[i].length-2])->structure[i][structure[i].length-1]
)IllegalArgumentException - if the structure length and the tensor length do not matchpublic static double getScoreForPath(Tensor score, int l, byte k, int[] path)
path using the first
l nodes and dependencies of order k.score - the Tensor of scoresl - the number of used nodes (from perm)k - the orderpath - the pathpublic static int[][] getStructureFromPath(int[] path,
Tensor score)
path and
score-"function".path - the pathscore - the Tensor of scorespublic static String toDirectedGraphvizFormat(int[][] structure)
String representation of the
structure that can be used in Graphviz to create an image.structure - the structure of the graphString representationtoGraphvizFormat(int[][], String)public static String toUndirectedGraphvizFormat(int[][] structure)
String representation of the
structure that can be used in Graphviz to create an image.structure - the structure of the graphString representationtoGraphvizFormat(int[][], String)public static String toWeightedGraphvizFormat(int[][] structure, String arrow, Tensor t)
String representation of the weighted
structure that can be used in Graphviz to create an image.structure - the structure of the grapharrow - the kind of arrow that is used between the nodes, e.g.
"--" and "->"t - the weightsString representation of the weighted structureprotected static String toGraphvizFormat(int[][] structure, String arrow)
String representation of the structure that
can be used in Graphviz to create an image.structure - the structure of the grapharrow - the kind of arrow that is used between the nodes, e.g.
"--" and "->"String representation of the structure