public class DefaultBarabasiAlbertModel extends java.lang.Object implements BarabasiAlbertModel
BarabasiAlbertModel
interface.
This implementation recomputes a cumulative distribution to select nodes
according to the preferential attachment mechanism which is highly
inefficient. Although it is the most common implementation among existing
libraries.Constructor and Description |
---|
DefaultBarabasiAlbertModel(org.apache.commons.configuration.Configuration config,
org.apache.commons.math3.random.RandomGenerator random,
Network network) |
Modifier and Type | Method and Description |
---|---|
void |
configure(org.apache.commons.configuration.Configuration configuration)
Configures the
NetworkModel with a given Configuration
instance. |
void |
configure(int numNodes,
int d,
long seed)
Configures the model to be executed with a given number of nodes and a
number of links to be added with each new node addition
|
Network |
generate()
Generates a
Network instance. |
org.apache.commons.configuration.Configuration |
getConfiguration()
Returns a configuration object which can be used to set parameter values
for the network model.
|
@Inject public DefaultBarabasiAlbertModel(org.apache.commons.configuration.Configuration config, org.apache.commons.math3.random.RandomGenerator random, Network network)
public Network generate()
NetworkModel
Network
instance. Note that this method should only
be called after the NetworkModel
is configured properly.
To correctly configure a model, you should refer to the documentation of
each model. The various models should supply enough information in their
documentation about what kind of parameters are expected and the valid
values for each parameter.generate
in interface NetworkModel
public void configure(int numNodes, int d, long seed) throws org.apache.commons.configuration.ConfigurationException
BarabasiAlbertModel
configure
in interface BarabasiAlbertModel
numNodes
- the number of nodes to be created in this modelseed
- the random number generator seed to be used with this
NetworkModelorg.apache.commons.configuration.ConfigurationException
public org.apache.commons.configuration.Configuration getConfiguration()
NetworkModel
Returns a configuration object which can be used to set parameter values
for the network model. After getting a configuration object and setting
the appropriate values, one can configure the model with the method
NetworkModel.configure(Configuration)
.
getConfiguration
in interface NetworkModel
public void configure(org.apache.commons.configuration.Configuration configuration) throws org.apache.commons.configuration.ConfigurationException
NetworkModel
Configures the NetworkModel
with a given Configuration
instance. Note that the configuration objects should be provided by each
network model instance and accessed using @
NetworkModel#getConfiguration()}.
configure
in interface NetworkModel
configuration
- a configuration with the appropriate parameters for the
network model to run.org.apache.commons.configuration.ConfigurationException
- an exception that should be thrown if the passed
configuration contains an invalid configuration (missing
parameters or invalid parameter values)