本文整理汇总了Python中Simulator.Simulator.genRandomLinks方法的典型用法代码示例。如果您正苦于以下问题:Python Simulator.genRandomLinks方法的具体用法?Python Simulator.genRandomLinks怎么用?Python Simulator.genRandomLinks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simulator.Simulator
的用法示例。
在下文中一共展示了Simulator.genRandomLinks方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doT1pT2p
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import genRandomLinks [as 别名]
def doT1pT2p(self):
print Community_Coordinate
nPnt=1000
nLink=40
nT1=40
nT2=20
tests=""
s=Simulator(nPnt)
s.genPoints()
s.genRandomLinks(nLink*nPnt)
f2 = open('doT1pT2p2.txt', 'w')
for i in range(0,101):
for j in range(0,i+1):
nSteps=self.MutiTimesNoGen(s,1,nT1,nT2,0.01*i,0.01*j)
print str(i)+"\t"+ str(j) +"\t"+str(nSteps)
f2.write(str(i)+"\t"+ str(j) +"\t"+str(nSteps)+"\n")
tests=tests+str(nSteps)+"\t"
for j in range(i,101):
tests=tests+"0\t"
tests=tests+("\n")
f = open('doT1pT2p.txt', 'w')
f.write(tests)
return
示例2: doT2Number
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import genRandomLinks [as 别名]
def doT2Number(self):
tests=[]
s=Simulator(1000,40,1)
s.genPoints()
s.genRandomLinks(40)
for i in range(10,31):
nSteps=self.MutiTimesNoGen(s,2,30,i,0.5,0.2)
print str(i) +"\t"+str(nSteps)
tests.append(nSteps)
print tests
return
示例3: doT1P
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import genRandomLinks [as 别名]
def doT1P(self):
tests=[]
s=Simulator(1000)
s.genPoints()
#s.genLinks(10*1000)
s.genRandomLinks(10*1000)
#s.setPointType(nOrigins, nLink1, nLink2, p1, p2)
for i in range(20,101):
nSteps=self.MutiTimesNoGen(s,1,30,10,0.01*i,0.2)
print str(i*0.01) +"\t"+str(nSteps)
tests.append(nSteps)
print tests
return
示例4: doT1nT2n
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import genRandomLinks [as 别名]
def doT1nT2n(self):
nPnt=1000
nLink=40
tests=""
s=Simulator(nPnt)
s.genPoints()
s.genRandomLinks(nLink*nPnt)
f2= open('doT1nT2n2.txt', 'w')
for i in range(0,100):
for j in range(0,i+1):
nSteps=self.MutiTimesNoGen(s,1,i,j,0.5,0.2)
print str(i)+"\t"+ str(j) +"\t"+str(nSteps)
f2.write(str(i)+"\t"+ str(j) +"\t"+str(nSteps)+"\n")
tests=tests+str(nSteps)+"\t"
for j in range(i,101):
tests=tests+"0\t"
tests=tests+("\n")
f = open('doT1nT2n.txt', 'w')
f.write(tests)
return