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 boolean
configured
Indicates if the generator has been configured or not.private boolean
directed
Indicates if the graph is directed or not.private Generator<U>
generator
User generator.private int
numNodes
Number of nodes of the graph.private double
prob
Probability 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:GraphGenerator
Configures the generator.- Specified by:
configure
in interfaceGraphGenerator<U>
- Parameters:
configuration
- An array containing the configuration parameters.
-
generate
Description copied from interface:GraphGenerator
Generates a graph.- Specified by:
generate
in interfaceGraphGenerator<U>
- Returns:
- the generated graph.
- Throws:
GeneratorNotConfiguredException
- The generator is not configured.
-