public interface KRegularModel extends NetworkModel
Defines an interface for the KRegular Network Model. This model generates k-regular ring lattice by connecting each node to their next k neighbours. Each node thus yields the same degree (2k).
You can either use the method configure(int, int, long)
present in the current interface or the general
configure
method from the NetworkModel
interface.
Injector injector = Guice.createInjector(new NetworkModule());
KRegularModel model = injector.getInstance(KRegularModel.class);
Configuration config = model.getConfiguration();
config.setProperty("numNodes", 1000);
config.setProperty("k", 1);
config.setProperty("seed", 0);
try{
model.configure(config);
}catch(ConfigurationException e){}
Network network = model.generate();
Modifier and Type | Method and Description |
---|---|
void |
configure(int numNodes,
int k,
long seed)
Configures the model.
|
configure, generate, getConfiguration
void configure(int numNodes, int k, long seed) throws org.apache.commons.configuration.ConfigurationException
numNodes
- the number of nodes to be createdk
- each node is attached to their k neighbours in a ring. Each
node will have a degree of 2K.seed
- the random number generator seedorg.apache.commons.configuration.ConfigurationException