def __initSmallWorld(self): defaultDict = {'rewiringProbability' : 0.5, 'delayTime' : 0.002, 'refractoryPeriod' : 0.021, 'nearestNeighbours': 25, 'nodeType': co.pcoIntegrateFireDelay()} print "Initializing SmallWorld Network" self.__appendParamsToDefault(defaultDict) self.cycle(self.__nodeCount, defaultDict['nearestNeighbours'], defaultDict['nodeType'], co.weightedEdge(defaultDict['couplingStrength'])) self.rewire(defaultDict['rewiringProbability'], defaultDict['nodeType']) self.randomizeStates(defaultDict['nodeType'], co.uniform(0.0, 1.0));
def __init__(self): """ DOCSTRING: """ self.defaultDict_NetworkType = {} #Topologie-Defaults self.__defaultDict_smallWorld = { # Defaults for smallWorld generation 'rewiringProbability': 0.5, 'nearestNeighbours': 25, 'edgeType': None, 'distributionType': co.uniform(0.0,1.0), } self.__defaultDict_randomGraph = {} self.__defaultDict_scaleFree = {}
import conedy as co N = co.network(); N.cycle (100,10, co.node(), co.weightedEdge()); print "should be 20:"+ str(N.meanDegree()) N.saveAdjacencyList("output/rewireWeights.co.before"); N.rewireWeights(0.5, co.uniform (2.0,2.0)); N.saveAdjacencyList("output/rewireWeights.co.after"); print "should be close to 1.5:"+ str(N.meanWeight())
N = co.network() nodeblueprint = co.gaussianRoessler() co.set("gaussianRoessler_a", 0.165) co.set("gaussianRoessler_b", 0.2) co.set("gaussianRoessler_c", 10.0) co.set("gaussianRoessler_sigmaNoise", 0.1) N.cycle(100, 4, nodeblueprint, co.weightedEdge(0.1)) N.rewire(0.1) print "clustering coefficient:" + str(N.meanClustering()) print "mean path length:" + str(N.meanPathLength()) if N.isConnected(): N.betweennessCentrality("N.betweenness") N.closenessCentrality("N.closeness") N.randomizeParameter("gaussianRoessler_omega", co.uniform(0.8, 1.2)) N.randomizeStates(nodeblueprint, co.uniform(-0.1, 0.1), co.uniform(-0.1, 0.1), co.uniform(-0.1, 0.1)) N.evolve(0.0, 100.0) N.observeTime("output_Roessler") N.observeAll("output_Roessler", co.component(2)) co.set("samplingTime", 0.01) N.evolve(100.0, 200.0)
import conedy as co N = co.network() N.cycle(100, 1, co.node(), co.weightedEdge()) N.randomizeWeights(co.uniform(0.0, 1.50)) print "should be close to 0.75:" + str(N.meanWeight())
co.set("pcoIntegrateFire_noiseFrequency", 0.0) co.set("pcoIntegrateFire_timeDelay", 0.01) co.set("pcoIntegrateFire_t_ref", 0.05) co.set("pcoIntegrateFire_alpha", 0.9) N = co.network() rewiring = 0.5 coupling = 0.012 #n.useLatticePositioning(100,100); N.torusNearestNeighbors(40,40,36.0, co.pcoIntegrateFire(), co.weightedEdge()) N.rewire(rewiring) N.randomizeStates(co.pcoIntegrateFire(), co.uniform(0.0,1.0)); N.randomizeWeights(co.uniform(coupling,coupling)); N.saveAdjacencyList("output/nonconverging.py.graph"); N.observeTime("output/nonconverging.py.phaseCoherence"); N.observePhaseCoherence("output/nonconverging.py.phaseCoherence"); N.evolve(0.0,100.0);
import conedy as co N = co.network() N.randomNetwork(100, 0.2, co.node(), co.weightedEdge()) N.randomizeWeights(co.uniform(0.0, 1.5)) print "Should be close to 0.75:" + str(N.meanWeight())
import conedy as co random = co.uniform (0.0,1.0)
import conedy as co N = co.network() N.randomNetwork(100, 0.1, co.roessler()) N.randomizeParameter ("roessler_omega", co.uniform (0.80, 0.85)) for i in range (0,100): print "Node " + str (i)+ ":"+ str(N.getParam(i, "roessler_omega"))
import conedy as co from os import system n = co.network() networkSize = 10 n.randomNetwork(networkSize, 0.4, co.node(), co.weightedEdge()) n.randomizeWeights(co.uniform(1.1, 1.1)) n.saveAdjacencyList("output/normalizeInputs.co.before") n.normalizeInWeightSum(3.0) print "Should be " + 3.0 / n.meanDegree() + " :" + n.meanWeight() n.saveAdjacencyList("output/normalizeInputs.co.after") system( "sort -n output/normalizeInputs.co.after -k2 > output/normalizeInputs.co.after.sort" )
import conedy as co N = co.network() N.randomNetwork(100, 0.1, co.roessler()) N.randomizeStates(co.roessler(), co.uniform (0.0,1.0), co.uniform (0.2,0.4), co.constant(0.8)) N.observeAll("output/randomizeStates.py.allStates",co.component(0)) N.observeAll("output/randomizeStates.py.allStates",co.component(1)) N.observeAll("output/randomizeStates.py.allStates",co.component(2)) N.snapshot()
import conedy as co N = co.network() N.addNode(co.kuramoto()) N.addNode(co.kuramoto()) N.addEdge (0,1, co.weightedEdge(2.0)) print "Should be true: " + str (N.isDirected()) N.addEdge (1,0, co.weightedEdge(0.1)) print "Should be true: " + str (N.isDirected()) N.randomizeWeights(co.uniform (3.0, 3.0)) print "Should be false: " + str (N.isDirected())
import conedy as co co.set("pcoMirollo_a" , 0.015) co.set("pcoMirollo_b" , 0.045) N = co.network() N.randomNetwork(1000, 0.01, co.pcoMirollo(),co.edge()) N.randomizeStates(co.pcoMirollo(), co.uniform(0.0, 1.0)) N.observeTime("order.dat") N.observePhaseCoherence("order.dat") N.evolve(0.0, 1000.0)
import conedy as co N = co.network() co.set ("roessler_a", 0.22) co.set ("roessler_b", 0.1) co.set ("roessler_c", 8.5) r1 = N.addNode(co.roessler()) r2 = N.addNode(co.roessler()) r3 = N.addNode(co.roessler()) N.setParam(r1, "roessler_omega", 1.02) N.setParam(r2, "roessler_omega", 1.0) N.setParam(r3, "roessler_omega", 0.98) N.randomizeStates (co.roessler(), co.uniform (-10.0, 10.0),co.uniform (-5.0, 5.0), co.uniform (-0.5, 1.5)) N.addEdge(r1, r2, co.weightedEdge(0.075)) N.addEdge(r2, r1, co.weightedEdge(0.075)) N.addEdge(r1, r3, co.weightedEdge(0.075)) N.addEdge(r3, r1, co.weightedEdge(0.075)) N.evolve(0.0, 100.0) N.observeTime("roessler.dat") N.observe(r1, "roessler.dat", co.component(1)) N.observe(r2, "roessler.dat", co.component(1)) N.observe(r3, "roessler.dat", co.component(1)) co.set("samplingTime", 0.01) N.evolve(100.0, 200.0)
import conedy as co N = co.network() for i in range (0,10000): N.addNode (co.node ()) N.addRandomEdgesDegreeDistribution(co.uniform (0.0,100.0), co.edge() ) N.inDegreeDistribution("output/addRandomEdgesDegreeDistribution.py.degDist") print N.meanDegree()
import conedy as co N = co.network() N.addNode(co.kuramoto()) N.addNode(co.kuramoto()) N.addEdge(0, 1, co.weightedEdge(2.0)) print "Should be true: " + str(N.isDirected()) N.addEdge(1, 0, co.weightedEdge(0.1)) print "Should be true: " + str(N.isDirected()) N.randomizeWeights(co.uniform(3.0, 3.0)) print "Should be false: " + str(N.isDirected())