Class ErdosGenerator<U>
java.lang.Object
es.uam.eps.ir.relison.graph.generator.random.ErdosGenerator<U>
- Type Parameters:
U- type of the users
- All Implemented Interfaces:
GraphGenerator<U>
public class ErdosGenerator<U> extends java.lang.Object implements GraphGenerator<U>
Generates a random graph following the Erdös-Renyi model.
Reference: P. Erdös, A. Rényi. On Random Graphs. I, Publicationes Mathematicae Debrecen 6(1), pp. 290-297 (1959)
-
Field Summary
Fields Modifier and Type Field Description private booleanconfiguredIndicates if the generator has been configured or not.private booleandirectedIndicates if the graph is directed or not.private Generator<U>generatorUser generator.private intnumNodesNumber of nodes of the graph.private doubleprobProbability of joining two edges. -
Constructor Summary
Constructors Constructor Description ErdosGenerator() -
Method Summary
-
Field Details
-
directed
private boolean directedIndicates if the graph is directed or not. -
numNodes
private int numNodesNumber of nodes of the graph. -
prob
private double probProbability of joining two edges. -
generator
User generator. -
configured
private boolean configuredIndicates if the generator has been configured or not.
-
-
Constructor Details
-
ErdosGenerator
public ErdosGenerator()
-
-
Method Details
-
configure
Configures the Erdos graph.- Parameters:
directed- Indicates if the graph edges are directed or not.numNodes- Number of nodes of the graph.prob- Probability of joining two edges.generator- Object that automatically creates the indicated number of nodes
-
configure
public void configure(java.lang.Object... configuration)Description copied from interface:GraphGeneratorConfigures the generator.- Specified by:
configurein interfaceGraphGenerator<U>- Parameters:
configuration- An array containing the configuration parameters.
-
generate
Description copied from interface:GraphGeneratorGenerates a graph.- Specified by:
generatein interfaceGraphGenerator<U>- Returns:
- the generated graph.
- Throws:
GeneratorNotConfiguredException- The generator is not configured.
-