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

    Modifier and Type Method Description
    void configure​(boolean directed, int numNodes, double prob, Generator<U> generator)
    Configures the Erdos graph.
    void configure​(java.lang.Object... configuration)
    Configures the generator.
    Graph<U> generate()
    Generates a graph.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • directed

      private boolean directed
      Indicates if the graph is directed or not.
    • numNodes

      private int numNodes
      Number of nodes of the graph.
    • prob

      private double prob
      Probability of joining two edges.
    • generator

      private Generator<U> generator
      User generator.
    • configured

      private boolean configured
      Indicates if the generator has been configured or not.
  • Constructor Details

  • Method Details

    • configure

      public void configure​(boolean directed, int numNodes, double prob, Generator<U> generator)
      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 interface GraphGenerator<U>
      Parameters:
      configuration - An array containing the configuration parameters.
    • generate

      public Graph<U> generate() throws GeneratorNotConfiguredException
      Description copied from interface: GraphGenerator
      Generates a graph.
      Specified by:
      generate in interface GraphGenerator<U>
      Returns:
      the generated graph.
      Throws:
      GeneratorNotConfiguredException - The generator is not configured.