Class GnpRandomBipartiteGraphGenerator<V,​E>

  • Type Parameters:
    V - the graph vertex type
    E - the graph edge type
    All Implemented Interfaces:
    GraphGenerator<V,​E,​V>

    public class GnpRandomBipartiteGraphGenerator<V,​E>
    extends java.lang.Object
    implements GraphGenerator<V,​E,​V>
    Create a random bipartite graph based on the G(n, p) Erdős–Rényi model. See the Wikipedia article for details and references about Random Graphs and the Erdős–Rényi model . The user provides the sizes n1 and n2 of the two partitions (n1+n2=n) and the probability p of the existence of an edge. The generator supports both directed and undirected graphs.
    Since:
    September 2016
    See Also:
    GnmRandomBipartiteGraphGenerator
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int n1  
      private int n2  
      private double p  
      private java.util.Random rng  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void generateGraph​(Graph<V,​E> target, VertexFactory<V> vertexFactory, java.util.Map<java.lang.String,​V> resultMap)
      Generates a random bipartite graph.
      • Methods inherited from class java.lang.Object

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

      • rng

        private final java.util.Random rng
      • n1

        private final int n1
      • n2

        private final int n2
      • p

        private final double p
    • Constructor Detail

      • GnpRandomBipartiteGraphGenerator

        public GnpRandomBipartiteGraphGenerator​(int n1,
                                                int n2,
                                                double p)
        Create a new random bipartite graph generator. The generator uses the G(n, p) model when n = n1 + n2 and the bipartite graph has one partition with size n1 and one partition with size n2. An edge between two vertices of different partitions is included with probability p independent of all other edges.
        Parameters:
        n1 - number of vertices of the first partition
        n2 - number of vertices of the second partition
        p - edge probability
      • GnpRandomBipartiteGraphGenerator

        public GnpRandomBipartiteGraphGenerator​(int n1,
                                                int n2,
                                                double p,
                                                long seed)
        Create a new random bipartite graph generator. The generator uses the G(n, p) model when n = n1 + n2, the bipartite graph has partition with size n1 and a partition with size n2. An edge between two vertices of different partitions is included with probability p independent of all other edges.
        Parameters:
        n1 - number of vertices of the first partition
        n2 - number of vertices of the second partition
        p - edge probability
        seed - seed for the random number generator
      • GnpRandomBipartiteGraphGenerator

        public GnpRandomBipartiteGraphGenerator​(int n1,
                                                int n2,
                                                double p,
                                                java.util.Random rng)
        Create a new random bipartite graph generator. The generator uses the G(n, p) model when n = n1 + n2, the bipartite graph has partition with size n1 and a partition with size n2. An edge between two vertices of different partitions is included with probability p independent of all other edges.
        Parameters:
        n1 - number of vertices of the first partition
        n2 - number of vertices of the second partition
        p - edge probability
        rng - random number generator
    • Method Detail

      • generateGraph

        public void generateGraph​(Graph<V,​E> target,
                                  VertexFactory<V> vertexFactory,
                                  java.util.Map<java.lang.String,​V> resultMap)
        Generates a random bipartite graph.
        Specified by:
        generateGraph in interface GraphGenerator<V,​E,​V>
        Parameters:
        target - the target graph
        vertexFactory - the vertex factory
        resultMap - not used by this generator, can be null