Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 1030
def _test(N,P): M = [] for a in range(10): # Make graph g = graphs.RandomGNP(N, P) # add the largest connected component to a M if g.is_connected() == False: print "trip" M.append(len(L[0])) return M
def test(N): P = .1 trip = False while trip == False: for a in range(10): print "loop", a # Make graph g = graphs.RandomGNP(N, P) # add the largest connected component to a M if g.is_connected() == False: print "P is too small" break if a == 9: trip = True break if trip == True: print P break P = P + .01 return P
test(10)
loop 0 P is too small loop 0 P is too small loop 0 loop 1 loop 2 loop 3 P is too small loop 0 loop 1 loop 2 loop 3 loop 4 loop 5 loop 6 loop 7 loop 8 loop 9 0.400000000000000 0.400000000000000
_test(10,.25)
trip trip clear trip trip clear trip clear clear trip [9, 9, 10, 7, 9, 10, 6, 10, 10, 9]
def Test(N): P = .1 trip = False while trip == False: for a in range(20): # Make graph g = graphs.RandomGNP(N, P) # add the largest connected component to a M if g.is_connected() == False: # print "P is too small" break if a == 9: trip = True break if trip == True: break P = P + .0001 return P Test(5)
0.410799999999969
def Threshold(N): for b in range (500, N): trip = False P = .005 while trip == False: for a in range(200): # Make graph g = graphs.RandomGNP(N, P) # add the largest connected component to a M if g.is_connected() == False: #print "P is too small" break if a == 199: print b, P trip = True break if trip == True: break P = P + .0001 return Threshold(600)
500 0.0180999999999999 501 0.0182999999999999 502 0.0182999999999999 503 0.0180999999999999 504 0.0191999999999999 505 0.0180999999999999 506 0.0185999999999999 507 0.0181999999999999 508 0.0176999999999999 509 0.0170000000000000 510 0.0175999999999999 511 0.0168000000000000 512 0.0178999999999999 513 0.0180999999999999 514 0.0185999999999999 515 0.0174999999999999 516 0.0162000000000000 517 0.0180999999999999 518 0.0182999999999999 519 0.0186999999999999 520 0.0176999999999999 521 0.0188999999999999 522 0.0180999999999999 523 0.0188999999999999 524 0.0187999999999999 525 0.0184999999999999 526 0.0174000000000000 527 0.0184999999999999 528 0.0194999999999999 529 0.0179999999999999 530 0.0183999999999999 531 0.0173000000000000 532 0.0165000000000000 533 0.0182999999999999 534 0.0177999999999999 535 0.0181999999999999 536 0.0177999999999999 537 0.0181999999999999 538 0.0182999999999999 539 0.0172000000000000 540 0.0179999999999999 541 0.0172000000000000 542 0.0177999999999999 543 0.0176999999999999 544 0.0182999999999999 545 0.0181999999999999 546 0.0187999999999999 547 0.0179999999999999 548 0.0185999999999999 549 0.0181999999999999 550 0.0178999999999999 551 0.0184999999999999 552 0.0171000000000000 553 0.0181999999999999 554 0.0180999999999999 555 0.0179999999999999 556 0.0174000000000000 557 0.0179999999999999 558 0.0179999999999999 559 0.0181999999999999 560 0.0176999999999999 561 0.0180999999999999 562 0.0174000000000000 563 0.0189999999999999 564 0.0181999999999999 565 0.0185999999999999 566 0.0182999999999999 567 0.0175999999999999 568 0.0178999999999999 569 0.0184999999999999 570 0.0183999999999999 571 0.0176999999999999 572 0.0186999999999999 573 0.0187999999999999 574 0.0172000000000000 575 0.0186999999999999 576 0.0169000000000000 577 0.0178999999999999 578 0.0196999999999999 579 0.0174999999999999 580 0.0175999999999999 581 0.0170000000000000 582 0.0180999999999999 583 0.0179999999999999 584 0.0180999999999999 585 0.0178999999999999 586 0.0168000000000000 587 0.0174000000000000 588 0.0180999999999999 589 0.0179999999999999 590 0.0184999999999999 591 0.0184999999999999 592 0.0183999999999999 593 0.0187999999999999 594 0.0186999999999999 595 0.0188999999999999 596 0.0181999999999999 597 0.0179999999999999 598 0.0174999999999999 599 0.0180999999999999
b = 100 while b < 10000: trip = False P = .001 while trip == False: for a in range(500): # Make graph g = graphs.RandomGNP(b, P) # add the largest connected component to a M if g.is_connected() == False: #print "P is too small" break if a == 199: print P #'for %s, %s is the threshold'%(n,p) trip = True break if trip == True: break P = P + .0001 b = b + 100
0.0861000000000014 0.0458000000000003 0.0335999999999999 0.0269999999999999 0.0218999999999999 0.0184999999999999 0.0157000000000000 0.0131000000000000 0.0133000000000000 0.0122000000000000 0.0112000000000000 0.00900000000000000 0.00910000000000000 0.00870000000000000 0.00820000000000001 0.00740000000000001 0.00720000000000001 0.00700000000000001 0.00660000000000000 0.00620000000000000 0.00620000000000000 0.00600000000000000 0.00560000000000000 0.00560000000000000 0.00530000000000000 0.00470000000000000 0.00470000000000000 0.00470000000000000 0.00470000000000000 0.00440000000000000 0.00450000000000000 0.00410000000000000 0.00420000000000000 0.00390000000000000 0.00400000000000000 0.00370000000000000 0.00360000000000000 0.00360000000000000 0.00350000000000000 0.00360000000000000 0.00340000000000000 0.00300000000000000 0.00310000000000000 0.00290000000000000 0.00320000000000000 0.00280000000000000 0.00290000000000000 0.00270000000000000 0.00290000000000000 0.00270000000000000 0.00260000000000000 0.00260000000000000 0.00240000000000000 0.00290000000000000 0.00250000000000000 0.00260000000000000 0.00260000000000000 0.00260000000000000 0.00240000000000000 0.00230000000000000 0.00230000000000000 0.00220000000000000 0.00220000000000000 0.00240000000000000 0.00220000000000000 0.00210000000000000 0.00220000000000000 0.00220000000000000 0.00240000000000000 0.00220000000000000 0.00210000000000000 0.00220000000000000 0.00230000000000000 0.00220000000000000 0.00210000000000000 0.00200000000000000 0.00210000000000000 0.00200000000000000 0.00200000000000000 0.00200000000000000 0.00190000000000000 0.00200000000000000 0.00190000000000000 0.00180000000000000 0.00180000000000000 0.00190000000000000 0.00190000000000000 0.00230000000000000 0.00220000000000000 0.00210000000000000 0.00200000000000000 0.00210000000000000 0.00200000000000000 0.00200000000000000 0.00200000000000000 0.00190000000000000 0.00200000000000000 0.00190000000000000 0.00180000000000000 0.00180000000000000 0.00190000000000000 0.00190000000000000
b = 100 while b < 10200: trip = False M = b - 10 while trip == False: for a in range(500): # Make graph g = graphs.RandomGNM(b, M) # add the largest connected component to a M if g.is_connected() == False: #print "P is too small" break if a == 499: print M #'for %s, %s is the threshold'%(n,p) trip = True break if trip == True: break M = M + 1 b = b + 100
472 947 1426 2084 2645 3243 4029 4451 5189 4029 4451 5189