Class WattsStrogatzGenerator<U>
java.lang.Object
es.uam.eps.ir.relison.graph.generator.random.WattsStrogatzGenerator<U>
- Type Parameters:
- U- Type of the vertices.
- All Implemented Interfaces:
- GraphGenerator<U>
public class WattsStrogatzGenerator<U> extends java.lang.Object implements GraphGenerator<U>
Generator for random graphs using the Watts-Strogatz model.
 Reference: D.J. Watts, S.H. Strogatz. Collective dynamics of 'small-world' networks. Nature 393(6684), pp. 440-442 (1998)
- 
Field SummaryFields Modifier and Type Field Description private doublebetaRewiring probabilityprivate booleanconfiguredIndicates if the generator is configuredprivate booleandirectedIndicates if the graph is directedprivate Generator<U>generatorNode generatorprivate intmeanDegreeAverage degree of the graph.private intnumNodesIndicates the number of nodes of the generated graph.private Graph<U>ringOriginal ring graph.
- 
Constructor SummaryConstructors Constructor Description WattsStrogatzGenerator()
- 
Method SummaryModifier and Type Method Description voidconfigure(boolean directed, int numNodes, int meanDegree, double beta, Generator<U> generator)Configures the graph generator.voidconfigure(java.lang.Object... configuration)Configures the generator.Graph<U>generate()Generates a graph.private voidrewire(Graph<U> graph, java.util.List<U> list, java.util.Random rng, U node, U adj)Rewires a connection in a graph.
- 
Field Details- 
directedprivate boolean directedIndicates if the graph is directed
- 
numNodesprivate int numNodesIndicates the number of nodes of the generated graph.
- 
meanDegreeprivate int meanDegreeAverage degree of the graph.
- 
betaprivate double betaRewiring probability
- 
generatorNode generator
- 
configuredprivate boolean configuredIndicates if the generator is configured
- 
ringOriginal ring graph.
 
- 
- 
Constructor Details- 
WattsStrogatzGeneratorpublic WattsStrogatzGenerator()
 
- 
- 
Method Details- 
configurepublic void configure(java.lang.Object... configuration)Description copied from interface:GraphGeneratorConfigures the generator.- Specified by:
- configurein interface- GraphGenerator<U>
- Parameters:
- configuration- An array containing the configuration parameters.
 
- 
configurepublic void configure(boolean directed, int numNodes, int meanDegree, double beta, Generator<U> generator)Configures the graph generator.- Parameters:
- directed- Indicates if the graph is directed.
- numNodes- Number of nodes of the graph.
- meanDegree- Average degree of the nodes.
- beta- Rewiring probability (between 0 and 1).
- generator- Node generator.
 
- 
generateDescription copied from interface:GraphGeneratorGenerates a graph.- Specified by:
- generatein interface- GraphGenerator<U>
- Returns:
- the generated graph.
- Throws:
- GeneratorNotConfiguredException- The generator is not configured.
- GeneratorBadConfiguredException- The generator parameters are incorretct.
 
- 
rewireRewires a connection in a graph.- Parameters:
- graph- the graph.
- list- the list of nodes in the graph.
- rng- the random number generator to determine whether we have to rewire or not.
- node- the origin node
- adj- the current destination node.
 
 
-