Class ErdosRenyiGenerator<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.generators.random.ErdosRenyiGenerator<V,E>
-
- All Implemented Interfaces:
GraphGenerator<V,E>,org.apache.commons.collections4.Factory<edu.uci.ics.jung.graph.Graph<V,E>>
public class ErdosRenyiGenerator<V,E> extends java.lang.Object implements GraphGenerator<V,E>
Generates a random graph using the Erdos-Renyi binomial model (each pair of vertices is connected with probability p).
-
-
Constructor Summary
Constructors Constructor Description ErdosRenyiGenerator(org.apache.commons.collections4.Factory<edu.uci.ics.jung.graph.UndirectedGraph<V,E>> graphFactory, org.apache.commons.collections4.Factory<V> vertexFactory, org.apache.commons.collections4.Factory<E> edgeFactory, int numVertices, double p)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description edu.uci.ics.jung.graph.Graph<V,E>create()Returns a graph in which each pair of vertices is connected by an undirected edge with the probability specified by the constructor.voidsetSeed(long seed)Sets the seed of the internal random number generator toseed.
-
-
-
Constructor Detail
-
ErdosRenyiGenerator
public ErdosRenyiGenerator(org.apache.commons.collections4.Factory<edu.uci.ics.jung.graph.UndirectedGraph<V,E>> graphFactory, org.apache.commons.collections4.Factory<V> vertexFactory, org.apache.commons.collections4.Factory<E> edgeFactory, int numVertices, double p)
- Parameters:
numVertices- number of vertices graph should havep- Connection's probability between 2 vertices
-
-
Method Detail
-
create
public edu.uci.ics.jung.graph.Graph<V,E> create()
Returns a graph in which each pair of vertices is connected by an undirected edge with the probability specified by the constructor.- Specified by:
createin interfaceorg.apache.commons.collections4.Factory<V>
-
setSeed
public void setSeed(long seed)
Sets the seed of the internal random number generator toseed. Enables consistent behavior.
-
-