cycle

network.cycle(size, b, node=dynNode, edge=weightedEdge)
Adds a closed chain to the network in which every node is connected to b neighbours on each side.

Parameters

size: integer
Number of nodes in the chain
b: integer
Each node is connected to its b nearest neighbours on each side.
node: node template
Every added node is a copy of this template.
edge: edge template
Every added edge is a copy of this template.

Returns

The number of the first added node. The following nodes have consecutive numbers.

Example (python-conedy)

import conedy as co



co.setRandomSeed(0)

N = co.network()


N.cycle(1000,50, co.node(), co.weightedEdge())   # Creates a closed chain of 1000 nodes where each is connected to its 50 nearest neighbors to each side.


print "should be close to 0.75:" + str ( N.meanClustering() )
print "should be close to " + str (1000.0/ 2 / 100) +":" + str ( N.meanPathLength() )
print "should be 100:" + str ( N.meanDegree() )

Example (conedy)

network N;


outputPrecision = 4;

N.cycle(1000,50, node(), weightedEdge());   # Creates a closed chain of 1000 nodes where each is connected to its 50 nearest neighbors to each side.


print "should be close to 0.75:" + ( N.meanClustering() ) + newline;
print "should be close to " + (1000.0/ 2 / 100) +":" + ( N.meanPathLength() ) + newline;
print "should be 100:" +  N.meanDegree()  + newline;

Table Of Contents

Previous topic

createFromAdjacencyMatrix

Next topic

isDirected