V - the graph vertex typeE - the graph edge typepublic class GnpRandomGraphGenerator<V,E> extends Object implements GraphGenerator<V,E,V>
In the G(n, p) model, a graph is constructed by connecting nodes randomly. Each edge is included in the graph with probability p independent from every other edge. The complexity of the generator is O(n^2) where n is the number of vertices.
 For the G(n, M) model please see GnmRandomGraphGenerator.
GnmRandomGraphGenerator| Constructor and Description | 
|---|
GnpRandomGraphGenerator(int n,
                       double p)
Create a new G(n, p) random graph generator. 
 | 
GnpRandomGraphGenerator(int n,
                       double p,
                       long seed)
Create a new G(n, p) random graph generator. 
 | 
GnpRandomGraphGenerator(int n,
                       double p,
                       long seed,
                       boolean loops)
Create a new G(n, p) random graph generator. 
 | 
GnpRandomGraphGenerator(int n,
                       double p,
                       Random rng,
                       boolean loops)
Create a new G(n, p) random graph generator. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
generateGraph(Graph<V,E> target,
             VertexFactory<V> vertexFactory,
             Map<String,V> resultMap)
Generates a random graph based on the G(n, p) model. 
 | 
public GnpRandomGraphGenerator(int n,
                               double p)
n - the number of nodesp - the edge probabilitypublic GnpRandomGraphGenerator(int n,
                               double p,
                               long seed)
n - the number of nodesp - the edge probabilityseed - seed for the random number generatorpublic GnpRandomGraphGenerator(int n,
                               double p,
                               long seed,
                               boolean loops)
n - the number of nodesp - the edge probabilityseed - seed for the random number generatorloops - whether the generated graph may create loopspublic GnpRandomGraphGenerator(int n,
                               double p,
                               Random rng,
                               boolean loops)
n - the number of nodesp - the edge probabilityrng - the random number generator to useloops - whether the generated graph may create loopspublic void generateGraph(Graph<V,E> target, VertexFactory<V> vertexFactory, Map<String,V> resultMap)
generateGraph in interface GraphGenerator<V,E,V>target - the target graphvertexFactory - the vertex factoryresultMap - not used by this generator, can be nullCopyright © 2017. All rights reserved.