replaceEdges

directedNetwork.replaceEdges(probability, edge, node) undirectedNetwork.replaceEdges(probability, node)

Replaces connections in the network by connections between randomly chosen source and target nodes.

Parameters

probability: double (\in\left[ 0, 1 \right])
Replacement probability.
edge: edge template
Replace edges with newly created edges of this type.
node: node template
Only consider edges for replacement if both, source and target node are of this type. If not specified, all edges are considered.

Example (python-conedy)

import conedy as co

N = co.network()


N.cycle ( 1000, 10, roessler(), weightedEdge(1.0));


print "mean degree before rewiring:" + str(N.meanDegree()
print "should be close to 0.75:" +  str( N.meanClustering())
N.replaceEdges(1.0, staticWeightedEdge(0.2));
print "mean degree after rewiring:" +  str(N.meanDegree())
print "should be close to 0.0:" +  str(N.meanClustering())

N.printNodeStatistics();

Example (conedy)

network N;

setRandomSeed(0);

N.cycle ( 1000, 10, roessler(), weightedEdge(1.0));




print "mean degree before rewiring:" + N.meanDegree()+ newline;
print "should be close to 0.75:" +  N.meanClustering()+ newline;
N.replaceEdges(1.0, staticWeightedEdge(0.2));
print "mean degree after rewiring:" +  N.meanDegree()+ newline;
print "should be close to 0.0:" +  N.meanClustering()+ newline;

N.printNodeStatistics();

Table Of Contents

Previous topic

removeRandomEdges

Next topic

replaceNode