Package org.jgrapht.generate
Class ScaleFreeGraphGenerator<V,E>
- java.lang.Object
-
- org.jgrapht.generate.ScaleFreeGraphGenerator<V,E>
-
- All Implemented Interfaces:
GraphGenerator<V,E,V>
public class ScaleFreeGraphGenerator<V,E> extends java.lang.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 Summary
Constructors Constructor Description ScaleFreeGraphGenerator(int size)
Constructs a new ScaleFreeGraphGenerator.ScaleFreeGraphGenerator(int size, long seed)
Constructs a new ScaleFreeGraphGenerator using fixed seed for the random generator.
-
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 scale-free network with size passed to the constructor.
-
-
-
Constructor Detail
-
ScaleFreeGraphGenerator
public ScaleFreeGraphGenerator(int size)
Constructs a new ScaleFreeGraphGenerator.- Parameters:
size
- number of vertices to be generated
-
ScaleFreeGraphGenerator
public ScaleFreeGraphGenerator(int size, long seed)
Constructs a new ScaleFreeGraphGenerator using fixed seed for the random generator.- Parameters:
size
- number of vertices to be generatedseed
- initial seed for the random generator
-
-
Method Detail
-
generateGraph
public void generateGraph(Graph<V,E> target, VertexFactory<V> vertexFactory, java.util.Map<java.lang.String,V> resultMap)
Generates scale-free network with size passed to the constructor. Each call of this method produces identical output (but if target is an undirected graph, the directions of edges will be lost).- Specified by:
generateGraph
in interfaceGraphGenerator<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 elementsvertexFactory
- called to produce new verticesresultMap
- unused parameter
-
-