Constructor and Description |
---|
GraphGenerators() |
Modifier and Type | Method and Description |
---|---|
static Edge<java.lang.Object>[] |
generateRandomEdges(int src,
int numEdges,
int maxVertexId,
long seed) |
static Graph<scala.Tuple2<java.lang.Object,java.lang.Object>,java.lang.Object> |
gridGraph(SparkContext sc,
int rows,
int cols)
Create
rows by cols grid graph with each vertex connected to its
row+1 and col+1 neighbors. |
static Graph<java.lang.Object,java.lang.Object> |
logNormalGraph(SparkContext sc,
int numVertices,
int numEParts,
double mu,
double sigma,
long seed)
Generate a graph whose vertex out degree distribution is log normal.
|
static double |
RMATa() |
static double |
RMATb() |
static double |
RMATc() |
static double |
RMATd() |
static Graph<java.lang.Object,java.lang.Object> |
rmatGraph(SparkContext sc,
int requestedNumVertices,
int numEdges)
A random graph generator using the R-MAT model, proposed in
"R-MAT: A Recursive Model for Graph Mining" by Chakrabarti et al.
|
static Graph<java.lang.Object,java.lang.Object> |
starGraph(SparkContext sc,
int nverts)
Create a star graph with vertex 0 being the center.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public static double RMATa()
public static double RMATb()
public static double RMATd()
public static Graph<java.lang.Object,java.lang.Object> logNormalGraph(SparkContext sc, int numVertices, int numEParts, double mu, double sigma, long seed)
The default values for mu and sigma are taken from the Pregel paper:
Grzegorz Malewicz, Matthew H. Austern, Aart J.C Bik, James C. Dehnert, Ilan Horn, Naty Leiser, and Grzegorz Czajkowski. 2010. Pregel: a system for large-scale graph processing. SIGMOD '10.
If the seed is -1 (default), a random seed is chosen. Otherwise, use the user-specified seed.
sc
- Spark ContextnumVertices
- number of vertices in generated graphnumEParts
- (optional) number of partitionsmu
- (optional, default: 4.0) mean of out-degree distributionsigma
- (optional, default: 1.3) standard deviation of out-degree distributionseed
- (optional, default: -1) seed for RNGs, -1 causes a random seed to be chosenpublic static double RMATc()
public static Edge<java.lang.Object>[] generateRandomEdges(int src, int numEdges, int maxVertexId, long seed)
public static Graph<java.lang.Object,java.lang.Object> rmatGraph(SparkContext sc, int requestedNumVertices, int numEdges)
See http://www.cs.cmu.edu/~christos/PUBLICATIONS/siam04.pdf
.
sc
- (undocumented)requestedNumVertices
- (undocumented)numEdges
- (undocumented)public static Graph<scala.Tuple2<java.lang.Object,java.lang.Object>,java.lang.Object> gridGraph(SparkContext sc, int rows, int cols)
rows
by cols
grid graph with each vertex connected to its
row+1 and col+1 neighbors. Vertex ids are assigned in row major
order.
sc
- the spark context in which to construct the graphrows
- the number of rowscols
- the number of columns
public static Graph<java.lang.Object,java.lang.Object> starGraph(SparkContext sc, int nverts)
sc
- the spark context in which to construct the graphnverts
- the number of vertices in the star
nverts
vertices with vertex 0
being the center vertex.