Class BarabasiGenerator<U>
java.lang.Object
es.uam.eps.ir.relison.graph.generator.random.BarabasiGenerator<U>
- Type Parameters:
U
- Type of the users
- All Implemented Interfaces:
GraphGenerator<U>
public class BarabasiGenerator<U> extends java.lang.Object implements GraphGenerator<U>
Generator for graphs following the Barabasi-Albert Preferential Attachment model for
graphs.
Reference: A-L. Barabási, R. Albert. Emergence of Scaling in Random Networks. Science 286(5439), pp. 509-512 (1999)
-
Field Summary
Fields Modifier and Type Field Description private boolean
configured
Indicates if the generator is configured or notprivate boolean
directed
Indicates if the graph is directed or notprivate Generator<U>
generator
User generator.private int
initialNodes
Number of initial nodesprivate int
numEdgesIter
Number of new edges created each iteration.private int
numIter
Number of iterations -
Constructor Summary
Constructors Constructor Description BarabasiGenerator()
-
Method Summary
-
Field Details
-
configured
private boolean configuredIndicates if the generator is configured or not -
directed
private boolean directedIndicates if the graph is directed or not -
initialNodes
private int initialNodesNumber of initial nodes -
numIter
private int numIterNumber of iterations -
numEdgesIter
private int numEdgesIterNumber of new edges created each iteration. -
generator
User generator.
-
-
Constructor Details
-
BarabasiGenerator
public BarabasiGenerator()
-
-
Method Details
-
configure
public void configure(java.lang.Object... configuration)Description copied from interface:GraphGenerator
Configures the generator.- Specified by:
configure
in interfaceGraphGenerator<U>
- Parameters:
configuration
- An array containing the configuration parameters.
-
configure
public void configure(boolean directed, int initialNodes, int numIter, int numEdgesIter, Generator<U> generator)Configures the graph.- Parameters:
directed
- Indicates if the node is directed or not.initialNodes
- Number of initial nodes of the graph.numIter
- Number of iterations of the algorithm.numEdgesIter
- Number of new edges to add each iterationgenerator
- Object that automatically creates the indicated number of nodes.
-
generate
Generates the graph.- Specified by:
generate
in interfaceGraphGenerator<U>
- Returns:
- A Barabasi-Albert model graph if everything OK.
- Throws:
GeneratorNotConfiguredException
- if the generator is not configuredGeneratorBadConfiguredException
- if the generator is badly configured. In this case, if the number of edges per iteration is greater than the number of initial nodes.
-