line

network.line(size, a, node template=dynNode, edge template=weightedEdge)
Adds an open chain to the network.

Parameters

size : integer
Number of nodes in the chain
a : integer
Each node is connected to its a nearest neighbours (unless at the boundary).
node template : node template
Every added node is a copy of this template.
edge template : 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



N = co.network()


N.line(1000,1, co.node(), co.weightedEdge(1.0))  # Creates a closed chain of 100 nodes where each is connected to its 10 nearest neighbors to each side.


print "should be 1000:" + str ( N.numberVertices() )
print "should be 1.0:" + str ( N.meanWeight() )

print "should be 0.0:" + str ( N.meanClustering() )
print "should be 333:" + str ( N.meanPathLength() )

print "should be close to 2:" + str ( N.meanDegree() )

Example (conedy)

network N;

N.line(1000,1, node(), weightedEdge(1.0));  # Creates a closed chain of 100 nodes where each is connected to its 10 nearest neighbors to each side.


print "should be 1000:" +  N.numberVertices() + newline ;
print "should be 1.0:" +  N.meanWeight() + newline ;

print "should be 0.0:" +  N.meanClustering()  + newline;
print "should be 333:" +  N.meanPathLength()  + newline;

print "should be close to 2:" +  N.meanDegree()  + newline;

Table Of Contents

Previous topic

lattice

Next topic

linkStrength