Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168745
Image: ubuntu2004
# square grid d = {0:[1,3], 1:[0,2,4], 2:[1,5,9], 3:[0,4,6], 4:[1,3,5,7], 5:[2,4,8,10], 6:[3,7], 7:[6,4,8], 8:[5,7,11,14], 9:[2,10], 10:[9,5,11], 11:[10,8,15], 12:[6,13], 13:[12,7,14], 14:[13,8,15], 15:[14,11]} G = Graph(d); G G.show()
# square grid made with adjacency matrix M = Matrix([(0,1,0,1,0,0,0,0,0),(1,0,1,0,1,0,0,0,0),(0,1,0,0,0,1,0,0,0),(1,0,0,0,1,0,1,0,0),(0,1,0,1,0,1,0,1,0),(0,0,1,0,1,0,0,0,1),(0,0,0,1,0,0,0,1,0),(0,0,0,0,1,0,1,0,1),(0,0,0,0,0,1,0,1,0)]) G = Graph(M); G G.show()
# rectangular grid d = {1:[2,6],2:[1,3],3:[2,8,4],4:[3,5],5:[4,10],6:[1,7],7:[6,8,12],8:[7,3,9],9:[8,10,14],10:[5,9],6:[1,7],7:[6,8,12],8:[3,7,9],9:[8,10,14],10:[5,9],11:[12,16],12:[11,7,13],13:[12,14,18],14:[9,13,15],15:[14,20],16:[11,17],17:[16,18],18:[13,17,19],19:[18,20],20:[15,19]} G = Graph(d); G G.show() # a cube (should be displayed with .show3d()) d = {1:[2,3,5],2:[1,4,6],3:[1,4,7],4:[2,3,8],5:[1,7,6],6:[5,2,8],7:[5,8,3],8:[6,7,4]} G = Graph(d); G G.show()
# a cube (should be displayed with .show3d()) d = {1:[2,3,5],2:[1,4,6],3:[1,4,7],4:[2,3,8],5:[1,7,6],6:[5,2,8],7:[5,8,3],8:[6,7,4]} G = Graph(d); G G.show()