public class GraphGenerators
extends Object
| Constructor and Description |
|---|
GraphGenerators() |
| Modifier and Type | Method and Description |
|---|---|
static Edge<Object>[] |
generateRandomEdges(int src,
int numEdges,
int maxVertexId,
long seed) |
static Graph<scala.Tuple2<Object,Object>,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<Object,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<Object,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<Object,Object> |
starGraph(SparkContext sc,
int nverts)
Create a star graph with vertex 0 being the center.
|
public static double RMATa()
public static double RMATb()
public static double RMATd()
public static Graph<Object,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<Object>[] generateRandomEdges(int src, int numEdges, int maxVertexId, long seed)
public static Graph<Object,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<Object,Object>,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<Object,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.