] names = [ 'G128a', 'G160', 'G128b', 'G112', 'G96a', 'G96b', 'G96c', 'G96d', 'G80a', 'G80b', 'G80c', 'G128c', 'G96', 'G96e', 'G96f', 'G80d', 'G96g', 'G96h' ] for N in range(2, len(graphs)): lengths = getEdgeLengthsByEmbedding('edges', [v1, v2, v3, v4, v5, v6, v7, v8], edges=graphs[N]) print graphs[N] start = time.time() # we run the sampling method based on coupler curves alg = AlgRealEmbeddings('edges', name=names[N], edges=graphs[N], num_sols=numbersOfComplexSolutions[N], allowedNumberOfMissing=10) lengths_final = alg.findMoreEmbeddings(lengths) print '\n\nSampling time: ', time.time() - start print '\n\nChecking and summary ' G = GraphEmbedding(lengths_final, 'edges', num_sols=numbersOfComplexSolutions[N]) print 'There are ', len( G.findEmbeddings() ['real']), 'real embeddings with the following edge lengths:' print lengths_final
v8 = [uniform(a, b), uniform(a, b), uniform(a, b)] v2 = [1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v4 = [1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v6 = [uniform(a, b), 1.0 + uniform(a, b), uniform(a, b)] v7 = [uniform(a, b), 1.0 + uniform(a, b), uniform(a, b)] v3 = [uniform(a, b), uniform(a, b), 1.0 + uniform(a, b)] v5 = [uniform(a, b), uniform(a, b), 1.0 + uniform(a, b)] lengths = getEdgeLengthsByEmbedding('Max8vertices', [v1, v2, v3, v4, v5, v6, v7, v8]) alg = AlgRealEmbeddings('Max8vertices', name='8vert_random_fromTetrahedron', allowedNumberOfMissing=14) alg.findMoreEmbeddings(lengths) except: pass # --------------------------------- try: v1 = [uniform(c, d), uniform(c, d), uniform(c, d)] v8 = [uniform(c, d), uniform(c, d), uniform(c, d)] v2 = [uniform(a, b), uniform(a, b), uniform(a, b)] v5 = [uniform(a, b), uniform(a, b), uniform(a, b)] v6 = [uniform(c, d), uniform(c, d), uniform(c, d)] v7 = [uniform(c, d), uniform(c, d), uniform(c, d)]
from graphEmbeddings3D.algRealEmbeddings import AlgRealEmbeddings from graphEmbeddings3D.graphEmbedding import getEdgeLengthsByEmbedding, GraphEmbedding from random import uniform a = -0.05 b = 0.05 L = [ {(1, 2): 9.032862424886133, (2, 7): 13.72608160429762, (4, 7): 10.53572330314948, (2, 6): 8.8124136360619918, (6, 7): 10.524846978527732, (5, 6): 0.5667571679193731, (5, 7): 10.53627365999783, (1, 4): 2.003436460984393, (1, 5): 2.00289249524296, (1, 3): 3.325513914287539, (1, 6): 1.9396324146809476, (4, 5): 1.001530148504854, (3, 7): 10.869692323177114, (3, 4): 3.1793342372525983, (2, 3): 9.540642897345043}, {(1, 2): 8.408431978862838, (2, 7): 13.323993408297303, (4, 7): 10.53572330314948, (2, 6): 8.218437267272142, (6, 7): 10.524661464352766, (5, 6): 0.5295354619564819, (5, 7): 10.53627365999783, (1, 4): 2.003436460984393, (1, 5): 2.00289249524296, (1, 3): 3.325513914287539, (1, 6): 1.9387736578515649, (4, 5): 1.001530148504854, (3, 7): 10.869692323177114, (3, 4): 3.1793342372525983, (2, 3): 8.93922391029478}, {(1, 2): 4.386290254987836, (2, 7): 11.232184203672034, (4, 7): 10.53572330314948, (2, 6): 3.9339443719412293, (6, 7): 10.524651892285146, (5, 6): 0.5264150074538269, (5, 7): 10.53627365999783, (1, 4): 2.003436460984393, (1, 5): 2.00289249524296, (1, 3): 7.313166095425311, (1, 6): 1.9387341135890943, (4, 5): 1.001530148504854, (3, 7): 12.677349678708367, (3, 4): 7.531555561165634, (2, 3): 8.669332474798372}, {(1, 2): 4.386290254987835, (2, 7): 11.232184203672034, (4, 7): 10.53572330314948, (2, 6): 3.96355207516054, (6, 7): 10.524670259119938, (5, 6): 0.5321679719883625, (5, 7): 10.53627365999783, (1, 4): 2.003436460984393, (1, 5): 2.00289249524296, (1, 3): 7.58982287777062, (1, 6): 1.9388109236436741, (4, 5): 1.001530148504854, (3, 7): 12.839296476824694, (3, 4): 7.818147937350013, (2, 3): 8.972719070171435}, {(1, 2): 4.386290254987836, (2, 7): 11.232184203672034, (4, 7): 10.53572330314948, (2, 6): 3.9339443719412293, (6, 7): 10.524651892285146, (5, 6): 0.5264150074538269, (5, 7): 10.53627365999783, (1, 4): 2.003436460984393, (1, 5): 2.00289249524296, (1, 3): 7.589822877770622, (1, 6): 1.9387341135890943, (4, 5): 1.001530148504854, (3, 7): 12.839296476824696, (3, 4): 7.818147937350017, (2, 3): 8.972719070171436}, {(1, 2): 3.6547267239838073, (2, 7): 10.931902209424029, (4, 7): 10.528964771703047, (2, 6): 12.36535326089277, (6, 7): 6.614718312956418, (5, 6): 15.12587430560531, (5, 7): 13.990265768289897, (1, 4): 1.9423383670562493, (1, 5): 9.822922401885547, (1, 3): 1.9354608517198846, (1, 6): 11.884171167050836, (4, 5): 9.723833100136652, (3, 7): 10.524273284504055, (3, 4): 0.5383946923429196, (2, 3): 3.283167602028824}, {(1, 2): 4.1414653501173975, (2, 7): 11.139850811829968, (4, 7): 10.523551385333088, (2, 6): 4.1677512911570815, (6, 7): 10.542828736351707, (5, 6): 1.0309584430720742, (5, 7): 10.533375487651346, (1, 4): 1.9363529242001118, (1, 5): 1.9873340498152834, (1, 3): 5.959257111560759, (1, 6): 2.0323899508242214, (4, 5): 0.4412801229952831, (3, 7): 11.949398151358958, (3, 4): 5.6557115598418122, (2, 3): 7.295330049669027}, {(1, 2): 6.274873914397456, (2, 7): 12.093170928755793, (4, 7): 10.52881316000657, (2, 6): 10.479941653322763, (6, 7): 8.11321631042846, (5, 6): 9.459324566316262, (5, 7): 10.73159467196586, (1, 4): 1.9761239449935557, (1, 5): 2.8483166740669206, (1, 3): 1.9564840951854308, (1, 6): 9.4046159048512159, (4, 5): 2.313950594269001, (3, 7): 10.525064001461296, (3, 4): 0.47038007668728976, (2, 3): 5.952813550679546}, {(1, 2): 3.2154982220265791, (2, 7): 1.4364348191352576, (4, 7): 17.879677295730822, (2, 6): 1.0237800945583886, (6, 7): 1.0148514465978793, (5, 6): 0.09495461781463814, (5, 7): 1.012349685743454, (1, 4): 18.137675008130483, (1, 5): 3.0323381652662267, (1, 3): 9.97279438841746, (1, 6): 3.0325698054329457, (4, 5): 17.849062036359275, (3, 7): 9.215048223037243, (3, 4): 19.765613007713743, (2, 3): 8.476438875510395}, {(1, 2): 5.7322526571145165, (2, 7): 5.026767140924392, (4, 7): 1.5859742422378464, (2, 6): 4.942519597534114, (6, 7): 1.0460328780197365, (5, 6): 0.22790172904533793, (5, 7): 1.0571151960916287, (1, 4): 3.273043816331718, (1, 5): 3.0531426208724093, (1, 3): 3.308244239022385, (1, 6): 3.044838116183432, (4, 5): 1.3350982559642988, (3, 7): 4.116856477203278, (3, 4): 4.437418243490294, (2, 3): 6.488691014736114} ] for lengths_7 in L: G = GraphEmbedding(lengths_7, 'Max7vertices') v1, v2, v3, v4, v5, v6, v7 = G.getEmbedding() v8 = [v6[0] + uniform(a, b), v6[1] + uniform(a, b), v6[2] + uniform(a, b)] lengths = getEdgeLengthsByEmbedding('Max8vertices', [v1, v2, v3, v4, v5, v6, v7, v8]) alg = AlgRealEmbeddings('Max8vertices', name='8vert_6and8close_fromG48') alg.findMoreEmbeddings(lengths)
from random import uniform #48 embedding for G48 a = -0.05 b = 0.05 c = -10.0 d = 10.0 edges_G160=[(1, 2), (1, 3), (1, 4), (1, 8), (2, 3), (2, 5), (2, 6), (2, 8), (3, 4), (3, 5), (3, 7),(4, 7), (4, 8), (5, 6), (5, 7), (6, 7), (6, 8), (7, 8)] #try: v3 = [0, 0, 0] v1 = [0, 5.73225265711452, 0] v2 = [0, 0.148291560665423, 3.30491899417522] v5 = [-3.1508917850189, 0.846961251730797, 0.259525376012296] v7 = [-2.49285516161801, 1.67204766459525, -0.558220040757827] v4 = [-2.59381676560345, 1.54400553897266, -0.398999543683517] v8 = [-1.69450165498139, 1.01237857741641, -0.346180158496239] v6 = [-3.1508917850189+uniform(a,b), 0.846961251730797+uniform(a,b), 0.259525376012296+uniform(a,b)] lengths = getEdgeLengthsByEmbedding('edges', [v1, v2, v3, v4, v5, v6, v7, v8], edges=edges_G160) alg = AlgRealEmbeddings('edges', name='G160', edges=edges_G160, num_sols=160, allowedNumberOfMissing=4, moreSamplingSubgraphs=False) lengths_final =alg.findMoreEmbeddings(lengths) G = GraphEmbedding(lengths_final, 'edges', num_sols=160) print 'There are ', len(G.findEmbeddings()['real']), 'real embeddings with the following edge lengths:' print lengths_final #except: # pass # ---------------------------------
'16': 2.000134247468136, '23': 0.999614322089483, '26': 1.001987710974071, '27': 10.53609172287933, '34': 1.00368644488060, '37': 10.53631716364608, '45': 1.001530148504854, '47': 10.53572330314948, '56': 0.995723616535744, '57': 10.53627365999783, '67': 10.53647884635266 } alg_threeIterations = AlgRealEmbeddings( 'Max7vertices', num_phi=24, num_theta=24, factor_second=8, name='7vert_from_Vangelis28_threeIterations') alg_threeIterations.findMoreEmbeddings(lengths, combinations=[[5, 6, 1, 7, 4], [4, 3, 1, 7, 5], [3, 2, 1, 7, 4]]) #result: #{(1, 2): 1.99993774567597, (2, 7): 10.53609172287933, (4, 7): 11.847062363994983, (2, 6): 1.001987710974071, (6, 7): 10.53647884635266, # (5, 6): 4.444937549609401, (5, 7): 11.239645246227646, (1, 4): 5.79633829024753, (1, 5): 4.402427328037957, (1, 3): 1.9341931539002355, # (1, 6): 2.000134247468136, (4, 5): 7.07440359713745, (3, 7): 10.524474002128432, (3, 4): 5.424721797777055, (2, 3): 0.549983624664826} alg_all_subgraphs = AlgRealEmbeddings( 'Max7vertices', num_phi=20, num_theta=20,
(5, 8): 4.298666616099013, (1, 2): 1.9998999999999987, (6, 8): 0.3982549922300802, (3, 4): 6.485469692789254, (5, 7): 11.34426742691038, (1, 5): 4.442915896298747, (2, 3): 1.4361061777829354, (7, 8): 10.474685613673127 }, { (2, 7): 10.534378549178047, (4, 7): 11.953077073699546, (2, 6): 0.8843324486337215, (4, 5): 7.2933103458646835, (2, 8): 0.8521243033186594, (1, 4): 6.601610459212839, (5, 6): 4.3210851909579535, (1, 3): 1.5642265690622923, (1, 6): 1.9958959696615104, (3, 7): 10.436345187325665, (5, 8): 4.274878564528476, (1, 2): 1.998702097423797, (6, 8): 0.3986010607688133, (3, 4): 6.506109453333499, (5, 7): 11.212007829070204, (1, 5): 4.394112286264732, (2, 3): 1.4104458613006143, (7, 8): 10.475125694129957 }]: alg = AlgRealEmbeddings('Max8vertices', name='8vert_resampling_from132') alg.findMoreEmbeddings(lengths)
v2 = [uniform(a, b), uniform(a, b), uniform(a, b)] v3 = [uniform(a, b), uniform(a, b), uniform(a, b)] v4 = [uniform(a, b), uniform(a, b), uniform(a, b)] v5 = [uniform(a, b), uniform(a, b), uniform(a, b)] v6 = [uniform(a, b), uniform(a, b), uniform(a, b)] # edge lengths are given as the distances in the embedding lengths = getEdgeLengthsByEmbedding('Max6vertices', [v1, v2, v3, v4, v5, v6]) # or the following edge lengths yields ones with 16 real embeddings: #lengths = {(1, 3): 0.5308353556228526, (5, 6): 1.8056034169357076, (2, 6): 2.4456570316770256, (2, 3): 0.8512597859002053, # (3, 5): 1.2853151143150572, (1, 2): 1.1757548283222, (4, 6): 0.9879010951471968, (1, 5): 0.7810003670625068, # (4, 5): 1.6175092476119708, (1, 6): 1.4488010671291325, (3, 4): 1.1784501009786457, (2, 4): 1.9763357382306461} start = time.time() # we run the sampling method based on coupler curves alg = AlgRealEmbeddings('Max6vertices', num_phi=5, num_theta=5, name='random6vert') lengths_final = alg.findMoreEmbeddings(lengths, allowed_repetition=2) print '\n\nSampling time: ', time.time() - start print '\n\nChecking and summary ' G = GraphEmbedding(lengths_final, 'Max6vertices') print 'There are ', len( G.findEmbeddings()['real'] ), 'real embeddings of the cyclohexane with the following edge lengths:' print lengths_final
a = -.0 b = 1.0 for i in range(0, 100): v1 = [uniform(a, b), uniform(a, b), uniform(a, b)] v2 = [uniform(a, b), uniform(a, b), uniform(a, b)] v3 = [uniform(a, b), uniform(a, b), uniform(a, b)] v4 = [uniform(a, b), uniform(a, b), uniform(a, b)] v5 = [uniform(a, b), uniform(a, b), uniform(a, b)] v6 = [uniform(a, b), uniform(a, b), uniform(a, b)] lengths_6vert = getEdgeLengthsByEmbedding('Max6vertices', [v1, v2, v3, v4, v5, v6]) alg6 = AlgRealEmbeddings('Max6vertices', num_phi=12, num_theta=12, name='rnd_6vert') name6 = alg6._fileNamePref lengths_6max = alg6.findMoreEmbeddings(lengths_6vert, allowed_repetition=1, required_num=16) #---------------------creating 7 vertex lengths--------------------------------------------- G = GraphEmbedding(lengths_6max, 'Max6vertices') v1, v2, v3, v7, v4, v5 = G.getEmbedding() v6 = [0, 0, 0] lengths_7vert = getEdgeLengthsByEmbedding('Max7vertices', [v1, v2, v3, v4, v5, v6, v7]) alg = AlgRealEmbeddings('Max7vertices', name='7vert_from_6vert')
a = -0.2 b = 0.2 for i in range(0, 100): v1 = [0.6 + uniform(a, b), 0.6 + uniform(a, b), -3.0 + uniform(a, b)] v2 = [-1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v3 = [1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v4 = [-1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v5 = [1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v6 = [1.0 + uniform(a, b), 1.0 + uniform(a, b), uniform(a, b)] v7 = [0.6 + uniform(a, b), 0.6 + uniform(a, b), 1.0 + uniform(a, b)] lengths = getEdgeLengthsByEmbedding('Max7vertices', [v1, v2, v3, v4, v5, v6, v7]) alg = AlgRealEmbeddings('Max7vertices', name='random7vert') lengths_7 = alg.findMoreEmbeddings(lengths, required_num=44) G = GraphEmbedding(lengths_7, 'Max7vertices') v1, v2, v3, v4, v5, v6, v7 = G.getEmbedding() v8 = [0, 0, 0] lengths = getEdgeLengthsByEmbedding('Max8vertices', [v1, v2, v3, v4, v5, v6, v7, v8]) alg2 = AlgRealEmbeddings('Max8vertices', name='from_rnd7to8') alg2.findMoreEmbeddings(lengths) del alg del alg2
b = 0.05 v1 = [0.6 + uniform(a, b), 0.6 + uniform(a, b), -3.0+ uniform(a, b)] v2 = [-1.0+uniform(a, b), uniform(a, b), uniform(a, b)] v3 = [1.0+uniform(a, b), uniform(a, b), uniform(a, b)] v4 = [-1.0+uniform(a, b), uniform(a, b), uniform(a, b)] v5 = [1.0+uniform(a, b), uniform(a, b), uniform(a, b)] v6 = [1.0+uniform(a, b), 1.0+uniform(a, b), uniform(a, b)] v7 = [0.6 + uniform(a, b), 0.6 + uniform(a, b), 1.0+uniform(a, b)] lengths = getEdgeLengthsByEmbedding('Max7vertices', [v1, v2, v3, v4, v5, v6,v7]) start = time.time() alg = AlgRealEmbeddings('Max7vertices', name='random7vert_tbr') alg.findMoreEmbeddings(lengths) print '\n\nSampling time: ', time.time() - start # possible result: #lengths = {(1, 2): 3.2154982220265791, (2, 7): 1.4364348191352576, (4, 7): 17.879677295730822, (2, 6): 1.0237800945583886, (6, 7): 1.0148514465978793, # (5, 6): 0.09495461781463814, (5, 7): 1.012349685743454, (1, 4): 18.137675008130483, (1, 5): 3.0323381652662267, (1, 3): 9.97279438841746, # (1, 6): 3.0325698054329457, (4, 5): 17.849062036359275, (3, 7): 9.215048223037243, (3, 4): 19.765613007713743, (2, 3): 8.476438875510395}
import sys sys.path.append('..') from graphEmbeddings3D.algRealEmbeddings import AlgRealEmbeddings from graphEmbeddings3D.graphEmbedding import getEdgeLengthsByEmbedding from random import uniform a = -5.0 b = 5.0 v1 = [uniform(a, b), uniform(a, b), uniform(a, b)] v2 = [uniform(a, b), uniform(a, b), uniform(a, b)] v3 = [uniform(a, b), uniform(a, b), uniform(a, b)] v4 = [uniform(a, b), uniform(a, b), uniform(a, b)] v5 = [uniform(a, b), uniform(a, b), uniform(a, b)] v6 = [uniform(a, b), uniform(a, b), uniform(a, b)] v7 = [uniform(a, b), uniform(a, b), uniform(a, b)] lengths = getEdgeLengthsByEmbedding('7vert32a', [v1, v2, v3, v4, v5, v6, v7]) alg = AlgRealEmbeddings('7vert32a', name='7vert32a_random', num_phi=12, num_theta=12) alg.findMoreEmbeddings(lengths) #one of the obtained edge lengths: #lengths = {(1, 2): 10.9464978614277, (4, 7): 8.7388471903030389, (1, 3): 6.27469003969716, (6, 7): 9.284894093430244, # (5, 6): 9.229604229826325, (5, 7): 7.8831186688053965, (1, 4): 8.062543016998301, (1, 6): 11.559732906664415, # (3, 6): 8.255957517599734, (2, 3): 8.827097289782333, (3, 7): 5.617334110160578, (2, 5): 9.741464052378111, # (3, 4): 6.1089666048644204, (2, 4): 8.949700966931744, (3, 5): 5.5980614315661095}
print __doc__ import sys sys.path.append('..') from graphEmbeddings3D.algRealEmbeddings import AlgRealEmbeddings import time start = time.time() lengths = {'12': 1.99993774567597, '13': 1.99476987780024, '14': 2.003436460984393, '15': 2.00289249524296, '16': 2.000134247468136, '23': 0.999614322089483, '26': 1.001987710974071, '27': 10.53609172287933, '34': 1.00368644488060, '37': 10.53631716364608, '45': 1.001530148504854, '47': 10.53572330314948, '56': 0.995723616535744, '57': 10.53627365999783, '67': 10.53647884635266} alg = AlgRealEmbeddings('Max7vertices', name='par7vert_tree_search') alg.findMoreEmbeddings_tree(lengths, onlyOne=True) print '\n\nSampling time: ', time.time() - start
''' print __doc__ import sys sys.path.append('..') from graphEmbeddings3D.algRealEmbeddings import AlgRealEmbeddings from graphEmbeddings3D.graphEmbedding import getEdgeLengthsByEmbedding from random import uniform a = -5.0 b = 5.0 v1 = [uniform(a, b), uniform(a, b), uniform(a, b)] v2 = [uniform(a, b), uniform(a, b), uniform(a, b)] v3 = [uniform(a, b), uniform(a, b), uniform(a, b)] v4 = [uniform(a, b), uniform(a, b), uniform(a, b)] v5 = [uniform(a, b), uniform(a, b), uniform(a, b)] v6 = [uniform(a, b), uniform(a, b), uniform(a, b)] v7 = [uniform(a, b), uniform(a, b), uniform(a, b)] lengths = getEdgeLengthsByEmbedding('7vert16b', [v1, v2, v3, v4, v5, v6,v7]) alg = AlgRealEmbeddings('7vert16b', name='7vert16b_random') alg.findMoreEmbeddings(lengths) #one of the obtained edge lengths: #lengths = {(2, 7): 5.895983148228586, (1, 2): 4.6193863752177702, (4, 7): 4.461504253664427, (2, 6): 7.47123257104987, # (6, 7): 3.0880879139441535, (4, 6): 7.067863188235056, (4, 5): 7.716042577713717, (1, 4): 6.514961476231782, # (1, 5): 5.692420153393312, (1, 3): 3.526562220615557, (2, 3): 7.686019585902205, (3, 6): 6.432943048336337, # (3, 7): 5.762187187187983, (2, 5): 9.484862380069352, (3, 5): 6.097065470256926}
This script uses the sampling method in order to find edge lengths of G160 with many real embeddings. Various kinds of random embeddings are used for obtaining starting edge lengths. ''' print __doc__ import sys sys.path.append('..') from graphEmbeddings3D.algRealEmbeddings import AlgRealEmbeddings from graphEmbeddings3D.graphEmbedding import getEdgeLengthsByEmbedding from random import uniform a = -0.1 b = 0.1 c = -10.0 d = 10.0 v1 = [uniform(a, b), uniform(a, b), uniform(a, b)] v7 = [uniform(a, b), uniform(a, b), uniform(a, b)] v2 = [uniform(c, d), uniform(c, d), uniform(c, d)] v3 = [uniform(c, d), uniform(c, d), uniform(c, d)] v4 = [uniform(c, d), uniform(c, d), uniform(c, d)] v5 = [uniform(c, d), uniform(c, d), uniform(c, d)] v6 = [uniform(c, d), uniform(c, d), uniform(c, d)] v8 = [uniform(c, d), uniform(c, d), uniform(c, d)] lengths = getEdgeLengthsByEmbedding('Max8vertices', [v1, v2, v3, v4, v5, v6, v7, v8]) alg = AlgRealEmbeddings('Max8vertices', name='8vert_random_1and7close') alg.findMoreEmbeddings(lengths)
(1, 4): 4.568340591813702, (1, 3): 3.314519658758949, (1, 6): 3.287451635976173, (3, 7): 0.7203607631189043, (5, 8): 8.128934153410903, (1, 2): 3.2998217710166675, (6, 8): 0.1038519304317517, (1, 5): 8.718648525503374, (3, 4): 3.571415592041678, (5, 7): 8.11372559232712, (5, 6): 8.131511514418733, (2, 3): 0.8279942119047615, (7, 8): 0.84990476615688959 } alg = AlgRealEmbeddings('Max8vertices', name='8vert') #alg.findMoreEmbeddings(lengths) #start = time.time() #G = GraphEmbedding(lengths, 'Max8vertices') #sols = G.findEmbeddings() #print len(sols['real']) #print len(sols['complex']) #end = time.time() #print 'Time: ' , end - start # # #n_L = {} #for e in lengths: # print e, lengths[e] # m, Ls = alg.sampleEdge(lengths, e, 50)
The starting edge lengths are chosen randomly so that top, ring and bottom edges have similar lengths, respectively. ''' print __doc__ import sys sys.path.append('..') from graphEmbeddings3D.algRealEmbeddings import AlgRealEmbeddings from graphEmbeddings3D.graphEmbedding import getEdgeLengthsByEmbedding from random import uniform a = -0.05 b = 0.05 v1 = [0.6 + uniform(a, b), 0.6 + uniform(a, b), -3.0 + uniform(a, b)] v2 = [-1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v4 = [-1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v6 = [-1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v3 = [1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v5 = [1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v7 = [1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v8 = [0.6 + uniform(a, b), 0.6 + uniform(a, b), 1.0 + uniform(a, b)] lengths = getEdgeLengthsByEmbedding('Ring8vertices', [v1, v2, v3, v4, v5, v6, v7, v8]) alg = AlgRealEmbeddings('Ring8vertices', name='8Ring_rnd_TBR') alg.findMoreEmbeddings(lengths)
v1 = [uniform(a, b), uniform(a, b), uniform(a, b)] v8 = [uniform(a, b), uniform(a, b), uniform(a, b)] v2 = [1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v4 = [1.0 + uniform(a, b), uniform(a, b), uniform(a, b)] v6 = [uniform(a, b), 1.0 + uniform(a, b), uniform(a, b)] v7 = [uniform(a, b), 1.0 + uniform(a, b), uniform(a, b)] v3 = [uniform(a, b), uniform(a, b), 1.0 + uniform(a, b)] v5 = [uniform(a, b), uniform(a, b), 1.0 + uniform(a, b)] lengths = getEdgeLengthsByEmbedding('Max8vertices_distSyst', [v1, v2, v3, v4, v5, v6, v7, v8]) alg = AlgRealEmbeddings('Max8vertices_distSyst', name='8vert_random_fromTetrahedron_dist') alg.findMoreEmbeddings(lengths) except: pass # --------------------------------- try: v1 = [uniform(c, d), uniform(c, d), uniform(c, d)] v8 = [uniform(c, d), uniform(c, d), uniform(c, d)] v2 = [uniform(a, b), uniform(a, b), uniform(a, b)] v5 = [uniform(a, b), uniform(a, b), uniform(a, b)] v6 = [uniform(c, d), uniform(c, d), uniform(c, d)] v7 = [uniform(c, d), uniform(c, d), uniform(c, d)] v3 = [uniform(c, d), uniform(c, d), uniform(c, d)]