edu.uci.ics.jung.algorithms.generators.random
Class KleinbergSmallWorldGenerator<V,E>

java.lang.Object
  extended by edu.uci.ics.jung.algorithms.generators.Lattice2DGenerator<V,E>
      extended by edu.uci.ics.jung.algorithms.generators.random.KleinbergSmallWorldGenerator<V,E>
All Implemented Interfaces:
GraphGenerator<V,E>, org.apache.commons.collections15.Factory<Graph<V,E>>

public class KleinbergSmallWorldGenerator<V,E>
extends Lattice2DGenerator<V,E>

Graph generator that produces a random graph with small world properties. The underlying model is an mxn (optionally toroidal) lattice. Each node u has four local connections, one to each of its neighbors, and in addition one long range connection to some node v where v is chosen randomly according to probability proportional to d^-alpha where d is the lattice distance between u and v and alpha is the clustering exponent.

Author:
Joshua O'Madadhain
See Also:
"Navigation in a small world J. Kleinberg, Nature 406(2000), 845."

Field Summary
 
Fields inherited from class edu.uci.ics.jung.algorithms.generators.Lattice2DGenerator
col_count, edge_factory, graph_factory, is_toroidal, row_count, vertex_factory
 
Constructor Summary
KleinbergSmallWorldGenerator(org.apache.commons.collections15.Factory<Graph<V,E>> graph_factory, org.apache.commons.collections15.Factory<V> vertex_factory, org.apache.commons.collections15.Factory<E> edge_factory, int latticeSize, double clusteringExponent)
          Creates
KleinbergSmallWorldGenerator(org.apache.commons.collections15.Factory<Graph<V,E>> graph_factory, org.apache.commons.collections15.Factory<V> vertex_factory, org.apache.commons.collections15.Factory<E> edge_factory, int row_count, int col_count, double clusteringExponent)
           
KleinbergSmallWorldGenerator(org.apache.commons.collections15.Factory<Graph<V,E>> graph_factory, org.apache.commons.collections15.Factory<V> vertex_factory, org.apache.commons.collections15.Factory<E> edge_factory, int row_count, int col_count, double clusteringExponent, boolean isToroidal)
           
 
Method Summary
 Graph<V,E> create()
          Generates a random small world network according to the parameters given
 void setRandom(Random random)
          Sets the Random instance used by this instance.
 void setRandomSeed(long seed)
          Sets the seed of the internal random number generator.
 
Methods inherited from class edu.uci.ics.jung.algorithms.generators.Lattice2DGenerator
getCol, getIndex, getRow, getVertex, getVertex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KleinbergSmallWorldGenerator

public KleinbergSmallWorldGenerator(org.apache.commons.collections15.Factory<Graph<V,E>> graph_factory,
                                    org.apache.commons.collections15.Factory<V> vertex_factory,
                                    org.apache.commons.collections15.Factory<E> edge_factory,
                                    int latticeSize,
                                    double clusteringExponent)
Creates

Parameters:
graph_factory -
vertex_factory -
edge_factory -
latticeSize -
clusteringExponent -

KleinbergSmallWorldGenerator

public KleinbergSmallWorldGenerator(org.apache.commons.collections15.Factory<Graph<V,E>> graph_factory,
                                    org.apache.commons.collections15.Factory<V> vertex_factory,
                                    org.apache.commons.collections15.Factory<E> edge_factory,
                                    int row_count,
                                    int col_count,
                                    double clusteringExponent)
Parameters:
graph_factory -
vertex_factory -
edge_factory -
row_count -
col_count -
clusteringExponent -

KleinbergSmallWorldGenerator

public KleinbergSmallWorldGenerator(org.apache.commons.collections15.Factory<Graph<V,E>> graph_factory,
                                    org.apache.commons.collections15.Factory<V> vertex_factory,
                                    org.apache.commons.collections15.Factory<E> edge_factory,
                                    int row_count,
                                    int col_count,
                                    double clusteringExponent,
                                    boolean isToroidal)
Parameters:
graph_factory -
vertex_factory -
edge_factory -
row_count -
col_count -
clusteringExponent -
isToroidal -
Method Detail

setRandom

public void setRandom(Random random)
Sets the Random instance used by this instance. Useful for unit testing.


setRandomSeed

public void setRandomSeed(long seed)
Sets the seed of the internal random number generator. May be used to provide repeatable experiments.


create

public Graph<V,E> create()
Generates a random small world network according to the parameters given

Specified by:
create in interface org.apache.commons.collections15.Factory<Graph<V,E>>
Overrides:
create in class Lattice2DGenerator<V,E>
Returns:
a random small world graph
See Also:
Factory.create()


Copyright © 2009. All Rights Reserved.