- java.lang.Object
- 
- org.jgrapht.generate.BarabasiAlbertForestGenerator<V,E>
 
- 
- Type Parameters:
- V- the graph vertex type
- E- the graph edge type
 - All Implemented Interfaces:
- GraphGenerator<V,E,V>
 
 public class BarabasiAlbertForestGenerator<V,E> extends Object implements GraphGenerator<V,E,V> Barabási-Albert growth and preferential attachment forest generator.The general graph generator is described in the paper: A.-L. Barabási and R. Albert. Emergence of scaling in random networks. Science, 286:509-512, 1999. The generator starts with a $t$ isolated nodes and grows the network by adding $n - t$ additional nodes. The additional nodes are added one by one and each of them is connected to one previously added node, where the probability of connecting to a node is proportional to its degree. Note that this Barabàsi-Albert generator only works on undirected graphs. For a version that works on both directed and undirected graphs and generates only connected graphs see BarabasiAlbertGraphGenerator.- Author:
- Alexandru Valeanu
 
- 
- 
Constructor SummaryConstructors Constructor Description BarabasiAlbertForestGenerator(int t, int n)ConstructorBarabasiAlbertForestGenerator(int t, int n, long seed)ConstructorBarabasiAlbertForestGenerator(int t, int n, Random rng)Constructor
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidgenerateGraph(Graph<V,E> target, Map<String,V> resultMap)Generates an instance.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.jgrapht.generate.GraphGeneratorgenerateGraph
 
- 
 
- 
- 
- 
Constructor Detail- 
BarabasiAlbertForestGeneratorpublic BarabasiAlbertForestGenerator(int t, int n)Constructor- Parameters:
- t- number of trees
- n- final number of nodes
- Throws:
- IllegalArgumentException- in case of invalid parameters
 
 - 
BarabasiAlbertForestGeneratorpublic BarabasiAlbertForestGenerator(int t, int n, long seed)Constructor- Parameters:
- t- number of trees
- n- final number of nodes
- seed- seed for the random number generator
- Throws:
- IllegalArgumentException- in case of invalid parameters
 
 - 
BarabasiAlbertForestGeneratorpublic BarabasiAlbertForestGenerator(int t, int n, Random rng)Constructor- Parameters:
- t- number of trees
- n- final number of nodes
- rng- the random number generator to use
- Throws:
- IllegalArgumentException- in case of invalid parameters
 
 
- 
 - 
Method Detail- 
generateGraphpublic void generateGraph(Graph<V,E> target, Map<String,V> resultMap) Generates an instance.Note: An exception will be thrown if the target graph is not empty (i.e. contains at least one vertex) - Specified by:
- generateGraphin interface- GraphGenerator<V,E,V>
- Parameters:
- target- the target graph
- resultMap- not used by this generator, can be null
- Throws:
- NullPointerException- if- targetis- null
- IllegalArgumentException- if- targetis not undirected
- IllegalArgumentException- if- targetis not empty
 
 
- 
 
-