Class EppsteinPowerLawGenerator<V,​E>

  • All Implemented Interfaces:
    com.google.common.base.Supplier<Graph<V,​E>>, GraphGenerator<V,​E>, java.util.function.Supplier<Graph<V,​E>>

    public class EppsteinPowerLawGenerator<V,​E>
    extends java.lang.Object
    implements GraphGenerator<V,​E>
    Graph generator that generates undirected graphs with power-law degree distributions.
    See Also:
    "A Steady State Model for Graph Power Law by David Eppstein and Joseph Wang"
    • Constructor Summary

      Constructors 
      Constructor Description
      EppsteinPowerLawGenerator​(com.google.common.base.Supplier<Graph<V,​E>> graphFactory, com.google.common.base.Supplier<V> vertexFactory, com.google.common.base.Supplier<E> edgeFactory, int numVertices, int numEdges, int r)
      Creates an instance with the specified factories and specifications.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Graph<V,​E> get()
      Generates a graph whose degree distribution approximates a power-law.
      protected Graph<V,​E> initializeGraph()  
      void setSeed​(long seed)
      Sets the seed for the random number generator.
      • Methods inherited from class java.lang.Object

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

      • mNumVertices

        private int mNumVertices
      • mNumEdges

        private int mNumEdges
      • mNumIterations

        private int mNumIterations
      • mMaxDegree

        private double mMaxDegree
      • mRandom

        private java.util.Random mRandom
      • graphFactory

        private com.google.common.base.Supplier<Graph<V,​E>> graphFactory
      • vertexFactory

        private com.google.common.base.Supplier<V> vertexFactory
      • edgeFactory

        private com.google.common.base.Supplier<E> edgeFactory
    • Constructor Detail

      • EppsteinPowerLawGenerator

        public EppsteinPowerLawGenerator​(com.google.common.base.Supplier<Graph<V,​E>> graphFactory,
                                         com.google.common.base.Supplier<V> vertexFactory,
                                         com.google.common.base.Supplier<E> edgeFactory,
                                         int numVertices,
                                         int numEdges,
                                         int r)
        Creates an instance with the specified factories and specifications.
        Parameters:
        graphFactory - the Supplier to use to generate the graph
        vertexFactory - the Supplier to use to create vertices
        edgeFactory - the Supplier to use to create edges
        numVertices - the number of vertices for the generated graph
        numEdges - the number of edges the generated graph will have, should be Theta(numVertices)
        r - the number of iterations to use; the larger the value the better the graph's degree distribution will approximate a power-law
    • Method Detail

      • initializeGraph

        protected Graph<V,​E> initializeGraph()
      • get

        public Graph<V,​E> get()
        Generates a graph whose degree distribution approximates a power-law.
        Specified by:
        get in interface com.google.common.base.Supplier<V>
        Specified by:
        get in interface java.util.function.Supplier<V>
        Returns:
        the generated graph
      • setSeed

        public void setSeed​(long seed)
        Sets the seed for the random number generator.
        Parameters:
        seed - input to the random number generator.