edu.stanford.math.plex4.graph.random
public class BinaryHierarchicalGraph extends GraphInstanceGenerator
GraphInstanceGenerator.ImplementationType| Modifier and Type | Field and Description |
|---|---|
protected boolean |
debugFlag |
protected int |
k |
protected double |
maxProbability |
protected int |
numNodes |
graphImplementation, implementationType| Modifier | Constructor and Description |
|---|---|
|
BinaryHierarchicalGraph(int n) |
protected |
BinaryHierarchicalGraph(int n,
boolean dummy)
Creates a HierarchicalGraph without any edges.
|
|
BinaryHierarchicalGraph(int n,
double maxProbability) |
| Modifier and Type | Method and Description |
|---|---|
protected AbstractUndirectedGraph |
construct(double maxProbability)
Construct the Hierarchical graph.
|
protected AbstractUndirectedGraph |
constructEdges(int n0,
int n1,
int k,
double[] probs)
Construct the edges of the graph using probabilities in the array probs.
|
protected void |
debug(java.lang.String msg) |
AbstractUndirectedGraph |
generate() |
double[] |
getProbabilities() |
protected double[] |
getProbabilities(int k,
double dampingFactor)
We need one probability for each potential common ancestor depth
d=1..k-1.
|
protected int |
getTreeDepth(int n)
We want to construct the smallest binary tree of size 2^{d+1}-1 (d>0)
such that there are at least n leaves.
|
java.lang.String |
toString() |
initializeGraph, setImplementationTypeprotected int numNodes
protected int k
protected double maxProbability
protected boolean debugFlag
public BinaryHierarchicalGraph(int n)
n - the number of nodespublic BinaryHierarchicalGraph(int n,
double maxProbability)
n - the number of nodes in the graphmaxProbability - the maximum edge probabilityprotected BinaryHierarchicalGraph(int n,
boolean dummy)
n - the number of nodesdummy - a dummy variable used to force this constructor to be usedpublic double[] getProbabilities()
public AbstractUndirectedGraph generate()
generate in class GraphInstanceGeneratorprotected AbstractUndirectedGraph construct(double maxProbability)
protected double[] getProbabilities(int k,
double dampingFactor)
k - a value such that (2^k <= n <= (2^{k+1})-1)dampingFactor - a scaling factor in the open set (0,1)protected AbstractUndirectedGraph constructEdges(int n0, int n1, int k, double[] probs)
n0 - the starting index of the binary tree leavesn1 - the ending index of the binary tree leavesk - a value such that [2^k <= n < 2^{k+1}]probs - an array of probabilities for each common ancestor depthprotected int getTreeDepth(int n)
public java.lang.String toString()
toString in class java.lang.Objectprotected void debug(java.lang.String msg)