Package org.apache.spark.graphx.util
Class GraphGenerators
Object
org.apache.spark.graphx.util.GraphGenerators
A collection of graph generating functions.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongenerateRandomEdges
(int src, int numEdges, int maxVertexId, long seed) gridGraph
(SparkContext sc, int rows, int cols) Createrows
bycols
grid graph with each vertex connected to its row+1 and col+1 neighbors.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 org.apache.spark.internal.Logging.LogStringContext
LogStringContext
(scala.StringContext sc) static org.slf4j.Logger
static void
org$apache$spark$internal$Logging$$log__$eq
(org.slf4j.Logger x$1) static double
RMATa()
static double
RMATb()
static double
RMATc()
static double
RMATd()
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.starGraph
(SparkContext sc, int nverts) Create a star graph with vertex 0 being the center.
-
Constructor Details
-
GraphGenerators
public GraphGenerators()
-
-
Method Details
-
RMATa
public static double RMATa() -
RMATb
public static double RMATb() -
RMATd
public static double RMATd() -
logNormalGraph
public 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.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.
- Parameters:
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 chosen- Returns:
- Graph object
-
RMATc
public static double RMATc() -
generateRandomEdges
-
rmatGraph
public 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.See http://www.cs.cmu.edu/~christos/PUBLICATIONS/siam04.pdf.
- Parameters:
sc
- (undocumented)requestedNumVertices
- (undocumented)numEdges
- (undocumented)- Returns:
- (undocumented)
-
gridGraph
public static Graph<scala.Tuple2<Object,Object>, gridGraphObject> (SparkContext sc, int rows, int cols) Createrows
bycols
grid graph with each vertex connected to its row+1 and col+1 neighbors. Vertex ids are assigned in row major order.- Parameters:
sc
- the spark context in which to construct the graphrows
- the number of rowscols
- the number of columns- Returns:
- A graph containing vertices with the row and column ids as their attributes and edge values as 1.0.
-
starGraph
Create a star graph with vertex 0 being the center.- Parameters:
sc
- the spark context in which to construct the graphnverts
- the number of vertices in the star- Returns:
- A star graph containing
nverts
vertices with vertex 0 being the center vertex.
-
org$apache$spark$internal$Logging$$log_
public static org.slf4j.Logger org$apache$spark$internal$Logging$$log_() -
org$apache$spark$internal$Logging$$log__$eq
public static void org$apache$spark$internal$Logging$$log__$eq(org.slf4j.Logger x$1) -
LogStringContext
public static org.apache.spark.internal.Logging.LogStringContext LogStringContext(scala.StringContext sc)
-