edu.stanford.math.plex4.graph.random
public class BAGraph extends GraphInstanceGenerator
GraphInstanceGenerator.ImplementationType
Modifier and Type | Field and Description |
---|---|
protected int |
mParam |
protected int |
nParam |
graphImplementation, implementationType
Constructor and Description |
---|
BAGraph(int n,
int m) |
Modifier and Type | Method and Description |
---|---|
AbstractUndirectedGraph |
generate()
This algorithm makes a power law graph with n nodes.
|
protected double[] |
getProbabilityPartition(int[] d)
Constructs a partition p of [0,1] such that p[i+1]-p[i] is proportional
to the degree of node i in the list d.
|
protected AbstractUndirectedGraph |
makeStarterGraph(int size,
AbstractUndirectedGraph graph)
Make a starter graph, in this case a line
TODO: what kind of starter graph??
|
java.lang.String |
toString() |
protected int |
whichSegmentHasX(double[] p,
double x)
Returns the segment i such that x is in [p[i],p[i+1]].
|
initializeGraph, setImplementationType
public AbstractUndirectedGraph generate()
generate
in class GraphInstanceGenerator
dataDimension
- the size of the graphnumDataPoints
- the number of potential edges to add at each step where m<protected int whichSegmentHasX(double[] p, double x)
p
- x
- protected double[] getProbabilityPartition(int[] d)
d
- protected AbstractUndirectedGraph makeStarterGraph(int size, AbstractUndirectedGraph graph)
numDataPoints
- public java.lang.String toString()
toString
in class java.lang.Object