randomNetwork

directedNetwork.randomNetwork(size, probability, node=dynNode, edge=weightedEdge) undirectedNetwork.randomNetwork(size, probability, node=dynNode, edge=weightedEdge)

Adds a random network.

Parameters

size: int
Number of nodes to be added.
probability: double (\in\left[ 0, 1 \right])
Probability for a connection between two nodes.
node: node template
Every added node is a copy of this template.
edge: edge template
Every added edge is a copy of this template.

Example (python-conedy)

import conedy as co

N = co.directedNetwork()

N.randomNetwork(100, 0.2, co.node(),  co.weightedEdge(1.0))

print "should be close to 20:" + str( N.meanDegree() )
print "should be close to 0.2:" + str( N.meanClustering() )
print "should be directed:" + str (N.isDirected())

UN = co.undirectedNetwork()

UN.randomNetwork(100, 0.2, co.node(),  co.weightedEdge(1.0))

print "should be close to 20:" + str( UN.meanDegree() )
print "should be close to 0.2:" + str( UN.meanClustering() )
print "should be undirected:" + str (UN.isDirected())

Example (conedy)

directedNetwork N;

N.randomNetwork(100, 0.2, node(),  weightedEdge(1.0));

print "should be close to 20:" +  N.meanDegree()  + newline;
print "should be close to 0.2:" +  N.meanClustering() + newline ;
print "should be directed:" + N.isDirected() + newline;

undirectedNetwork UN;

UN.randomNetwork(100, 0.2, node(),  weightedEdge(1.0));

print "should be close to 20:" +  UN.meanDegree()  + newline;
print "should be close to 0.2:" +  UN.meanClustering() + newline ;
print "should be undirected:" + UN.isDirected() + newline;

Table Of Contents

Previous topic

numberVertices

Next topic

randomizeParameter