- Type Parameters:
V- the graph vertex typeE- the graph edge type
- All Implemented Interfaces:
GraphGenerator<V,E, V>
The generator is described in the paper: J. Kleinberg, The Small-World Phenomenon: An Algorithmic Perspective, in Proc. 32nd ACM Symp. Theory of Comp., 163-170, 2000.
The basic structure is a a two-dimensional grid and allows for edges to be directed. It begins with a set of nodes (representing individuals in the social network) that are identified with the set of lattice points in an $n \times n$ square. For a universal constant $p \geq 1$, the node $u$ has a directed edge to every other node within lattice distance $p$ (these are its local contacts). For universal constants $q \geq 0$ and $r \geq 0$, we also construct directed edges from $u$ to $q$ other nodes (the long-range contacts) using independent random trials; the i-th directed edge from $u$ has endpoint $v$ with probability proportional to \frac{1}{d(u,v)^r}$ where $d(u,v)$ is the lattice distance from $u$ to $v$.
- Author:
- Dimitrios Michail
-
Constructor Summary
ConstructorsConstructorDescriptionKleinbergSmallWorldGraphGenerator(int n, int p, int q, int r) ConstructorKleinbergSmallWorldGraphGenerator(int n, int p, int q, int r, long seed) ConstructorKleinbergSmallWorldGraphGenerator(int n, int p, int q, int r, Random rng) Constructor -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jgrapht.generate.GraphGenerator
generateGraph
-
Constructor Details
-
KleinbergSmallWorldGraphGenerator
public KleinbergSmallWorldGraphGenerator(int n, int p, int q, int r) Constructor- Parameters:
n- generate set of lattice points in a $n$ by $n$ squarep- lattice distance for which each node is connected to every other node in the lattice (local connections)q- how many long-range contacts to add for each noder- probability distribution parameter which is a basic structural parameter measuring how widely "networked" the underlying society of nodes is- Throws:
IllegalArgumentException- in case of invalid parameters
-
KleinbergSmallWorldGraphGenerator
public KleinbergSmallWorldGraphGenerator(int n, int p, int q, int r, long seed) Constructor- Parameters:
n- generate set of lattice points in a $n$ by $n$ squarep- lattice distance for which each node is connected to every other node in the lattice (local connections)q- how many long-range contacts to add for each noder- probability distribution parameter which is a basic structural parameter measuring how widely "networked" the underlying society of nodes isseed- seed for the random number generator- Throws:
IllegalArgumentException- in case of invalid parameters
-
KleinbergSmallWorldGraphGenerator
Constructor- Parameters:
n- generate set of lattice points in a $n \times n$ squarep- lattice distance for which each node is connected to every other node in the lattice (local connections)q- how many long-range contacts to add for each noder- probability distribution parameter which is a basic structural parameter measuring how widely "networked" the underlying society of nodes isrng- the random number generator to use- Throws:
IllegalArgumentException- in case of invalid parameters
-
-
Method Details
-
generateGraph
Generates a small-world graph.- Specified by:
generateGraphin interfaceGraphGenerator<V,E, V> - Parameters:
target- the target graphresultMap- not used by this generator, can be null
-