|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.uci.ics.jung.algorithms.generators.random.BarabasiAlbertGenerator<V,E>
public class BarabasiAlbertGenerator<V,E>
Simple evolving scale-free random graph generator. At each time step, a new vertex is created and is connected to existing vertices according to the principle of "preferential attachment", whereby vertices with higher degree have a higher probability of being selected for attachment.
At a given timestep, the probability p
of creating an edge
between an existing vertex v
and the newly added vertex is
p = (degree(v) + 1) / (|E| + |V|);
where |E|
and |V|
are, respectively, the number
of edges and vertices currently in the network (counting neither the new
vertex nor the other edges that are being attached to it).
Note that the formula specified in the original paper (cited below) was
p = degree(v) / |E|
However, this would have meant that the probability of attachment for any existing isolated vertex would be 0. This version uses Lagrangian smoothing to give each existing vertex a positive attachment probability.
The graph created may be either directed or undirected (controlled by a constructor parameter); the default is undirected. If the graph is specified to be directed, then the edges added will be directed from the newly added vertex u to the existing vertex v, with probability proportional to the indegree of v (number of edges directed towards v). If the graph is specified to be undirected, then the (undirected) edges added will connect u to v, with probability proportional to the degree of v.
The parallel
constructor parameter specifies whether parallel edges
may be created.
Field Summary | |
---|---|
protected org.apache.commons.collections15.Factory<E> |
edgeFactory
|
protected org.apache.commons.collections15.Factory<Graph<V,E>> |
graphFactory
|
protected Map<V,Integer> |
index_vertex
|
protected int |
init_vertices
|
protected List<V> |
vertex_index
|
protected org.apache.commons.collections15.Factory<V> |
vertexFactory
|
Constructor Summary | |
---|---|
BarabasiAlbertGenerator(org.apache.commons.collections15.Factory<Graph<V,E>> graphFactory,
org.apache.commons.collections15.Factory<V> vertexFactory,
org.apache.commons.collections15.Factory<E> edgeFactory,
int init_vertices,
int numEdgesToAttach,
int seed,
Set<V> seedVertices)
Constructs a new instance of the generator. |
|
BarabasiAlbertGenerator(org.apache.commons.collections15.Factory<Graph<V,E>> graphFactory,
org.apache.commons.collections15.Factory<V> vertexFactory,
org.apache.commons.collections15.Factory<E> edgeFactory,
int init_vertices,
int numEdgesToAttach,
Set<V> seedVertices)
Constructs a new instance of the generator, whose output will be an undirected graph, and which will use the current time as a seed for the random number generation. |
Method Summary | |
---|---|
Graph<V,E> |
create()
|
void |
evolveGraph(int numTimeSteps)
Instructs the algorithm to evolve the graph N steps. |
int |
numIterations()
Retrieves the total number of steps elapsed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<V> vertex_index
protected int init_vertices
protected Map<V,Integer> index_vertex
protected org.apache.commons.collections15.Factory<Graph<V,E>> graphFactory
protected org.apache.commons.collections15.Factory<V> vertexFactory
protected org.apache.commons.collections15.Factory<E> edgeFactory
Constructor Detail |
---|
public BarabasiAlbertGenerator(org.apache.commons.collections15.Factory<Graph<V,E>> graphFactory, org.apache.commons.collections15.Factory<V> vertexFactory, org.apache.commons.collections15.Factory<E> edgeFactory, int init_vertices, int numEdgesToAttach, int seed, Set<V> seedVertices)
init_vertices
- number of unconnected 'seed' vertices that the graph should start withnumEdgesToAttach
- the number of edges that should be attached from the
new vertex to pre-existing vertices at each time stepdirected
- specifies whether the graph and edges to be created should be directed or notparallel
- specifies whether the algorithm permits parallel edgesseed
- random number seedpublic BarabasiAlbertGenerator(org.apache.commons.collections15.Factory<Graph<V,E>> graphFactory, org.apache.commons.collections15.Factory<V> vertexFactory, org.apache.commons.collections15.Factory<E> edgeFactory, int init_vertices, int numEdgesToAttach, Set<V> seedVertices)
init_vertices
- number of vertices that the graph should start withnumEdgesToAttach
- the number of edges that should be attached from the
new vertex to pre-existing vertices at each time stepMethod Detail |
---|
public void evolveGraph(int numTimeSteps)
EvolvingGraphGenerator
evolveGraph
in interface EvolvingGraphGenerator<V,E>
numTimeSteps
- number of steps to iterate from the current statepublic int numIterations()
EvolvingGraphGenerator
numIterations
in interface EvolvingGraphGenerator<V,E>
public Graph<V,E> create()
create
in interface org.apache.commons.collections15.Factory<Graph<V,E>>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |