Class ScaleFreeGraphGenerator<V,​E>

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

    public class ScaleFreeGraphGenerator<V,​E>
    extends Object
    implements GraphGenerator<V,​E,​V>
    Generates directed or undirected scale-free network of any size. Scale-free network is a connected graph, where degrees of vertices are distributed in unusual way. There are many vertices with small degrees and only small amount of vertices with big degrees.
    Author:
    Ilya Razenshteyn
    • Constructor Detail

      • ScaleFreeGraphGenerator

        public ScaleFreeGraphGenerator​(int size)
        Constructor
        Parameters:
        size - number of vertices to be generated
      • ScaleFreeGraphGenerator

        public ScaleFreeGraphGenerator​(int size,
                                       long seed)
        Constructor
        Parameters:
        size - number of vertices to be generated
        seed - initial seed for the random generator
      • ScaleFreeGraphGenerator

        public ScaleFreeGraphGenerator​(int size,
                                       Random rng)
        Constructor
        Parameters:
        size - number of vertices to be generated
        rng - the random number generator
    • Method Detail

      • generateGraph

        public void generateGraph​(Graph<V,​E> target,
                                  Map<String,​V> resultMap)
        Generates scale-free network with size passed to the constructor.
        Specified by:
        generateGraph in interface GraphGenerator<V,​E,​V>
        Parameters:
        target - receives the generated edges and vertices; if this is non-empty on entry, the result will be a disconnected graph since generated elements will not be connected to existing elements
        resultMap - unused parameter, can be null