Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: graphos
Views: 63
casa=graphs.HouseGraph()
casa.show()
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python3.9/site-packages/smc_sagews/sage_server.py", line 1234, in execute flags=compile_flags), namespace, locals) File "", line 1, in <module> NameError: name 'casa' is not defined
plato1=graphs.DodecahedralGraph() plato1.show()
casa.add_vertices([5])
casa.is_connected()
False
casa.add_edges([(5,3),(5,1)])
casa.show()
casa.automorphism_group()
Permutation Group with generators [(1,2)(4,5)]
print casa.vertices()
[0, 1, 2, 3, 4, 5]
for vv in casa.vertices(): print vv, casa.degree(vv)
0 2 1 3 2 3 3 4 4 2 5 2
casa.size()
8
casa.order()
6
show(casa)
d3-based renderer not yet implemented
tutica=graphs.GrayGraph()
show(tutica)
d3-based renderer not yet implemented
tutica.is_regular()
True
tutica.neighbors(31)
[32, 38, 30]
tutica.neighbors(8)
[1, 7, 9]
Ma=casa.adjacency_matrix()
Ma
[0 1 1 0 0] [1 0 0 1 0] [1 0 0 1 1] [0 1 1 0 1] [0 0 1 1 0]
yas=Graph() yas.add_vertices(range(15))
yas.add_edges([(0,1),(1,2),(2,3),(3,4),(4,5),(5,6),(6,7),(7,8),(8,9),(9,10),(10,11),(11,12),(12,13),(13,0)])
show(yas)
d3-based renderer not yet implemented
yas.delete_vertex(14)
show(yas)
d3-based renderer not yet implemented
yas.add_edges([(13,2),(11,2),(10,3),(9,4),(9,6)])
show(yas)
d3-based renderer not yet implemented
yas.automorphism_group()
Permutation Group with generators [(0,7)(1,8)(2,9)(3,10)(4,11)(5,12)(6,13)]
for ii in yas.vertices(): print ii , yas.degree(ii)
0 2 1 2 2 4 3 3 4 3 5 2 6 3 7 2 8 2 9 4 10 3 11 3 12 2 13 3
yas.size()
19
tuta=[(x,y) for x in range(1,37) for y in range(1,37) if (36%x==0 and 36%y==0 and not (36%(x*y)==0))]
tuta
[(2, 4), (2, 12), (2, 36), (3, 9), (3, 18), (3, 36), (4, 2), (4, 4), (4, 6), (4, 12), (4, 18), (4, 36), (6, 4), (6, 9), (6, 12), (6, 18), (6, 36), (9, 3), (9, 6), (9, 9), (9, 12), (9, 18), (9, 36), (12, 2), (12, 4), (12, 6), (12, 9), (12, 12), (12, 18), (12, 36), (18, 3), (18, 4), (18, 6), (18, 9), (18, 12), (18, 18), (18, 36), (36, 2), (36, 3), (36, 4), (36, 6), (36, 9), (36, 12), (36, 18), (36, 36)]
tete=[x*x*y*y for (x,y) in tuta]
tete
[64, 576, 5184, 729, 2916, 11664, 64, 256, 576, 2304, 5184, 20736, 576, 2916, 5184, 11664, 46656, 729, 2916, 6561, 11664, 26244, 104976, 576, 2304, 5184, 11664, 20736, 46656, 186624, 2916, 5184, 11664, 26244, 46656, 104976, 419904, 5184, 11664, 20736, 46656, 104976, 186624, 419904, 1679616]
sum=0 for ii in tete: sum=ii sum
1679616
runa=Graph()
runa.add_vertices(range(5))
runa.add_edges([(0,1),(1,2),(1,3),(1,4)])
runa.show()
runa3=runa
runa3.add_edge(2,3)
runa3.show()
runa3n4n0=runa3
runa3n4n0.add_edge(4,0) runa3n4n0.show()
runa3P=Graph() runa3P.add_vertices(range(5)) runa3P.add_edges([(2,1),(3,1),(1,4),(1,0),(0,4),(0,2)]) runa3P.show()
runa3PW=Graph() runa3PW.add_vertices(range(5)) runa3PW.add_edges([(2,1),(3,1),(1,4),(1,0),(0,4),(0,2),(4,3)]) runa3PW.show()
runa3PWZ=Graph() runa3PWZ.add_vertices(range(5)) runa3PWZ.add_edges([(2,1),(3,1),(1,4),(1,0),(0,4),(0,2),(4,3),(2,3)]) runa3PWZ.show()
runa3PXWZ=Graph() runa3PXWZ.add_vertices(range(5)) runa3PXWZ.add_edges([(2,1),(1,4),(1,0),(0,4),(0,2),(4,3),(2,3)]) runa3PXWZ.show()