Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: SA403_F17
Views: 150
g = graphs.PetersenGraph() g.show() show(graphs.PetersenGraph())A = g.adjacency_matrix() A AI = g.incidence_matrix() AI
[0 1 0 0 1 1 0 0 0 0] [1 0 1 0 0 0 1 0 0 0] [0 1 0 1 0 0 0 1 0 0] [0 0 1 0 1 0 0 0 1 0] [1 0 0 1 0 0 0 0 0 1] [1 0 0 0 0 0 0 1 1 0] [0 1 0 0 0 0 0 0 1 1] [0 0 1 0 0 1 0 0 0 1] [0 0 0 1 0 1 1 0 0 0] [0 0 0 0 1 0 1 1 0 0] [1 1 1 0 0 0 0 0 0 0 0 0 0 0 0] [1 0 0 1 1 0 0 0 0 0 0 0 0 0 0] [0 0 0 1 0 1 1 0 0 0 0 0 0 0 0] [0 0 0 0 0 1 0 1 1 0 0 0 0 0 0] [0 1 0 0 0 0 0 1 0 1 0 0 0 0 0] [0 0 1 0 0 0 0 0 0 0 1 1 0 0 0] [0 0 0 0 1 0 0 0 0 0 0 0 1 1 0] [0 0 0 0 0 0 1 0 0 0 1 0 0 0 1] [0 0 0 0 0 0 0 0 1 0 0 1 1 0 0] [0 0 0 0 0 0 0 0 0 1 0 0 0 1 1]
#g = Graph([(0,1),(1,2),(2,3),(0,3)]) #g.show() M = Matrix([ [0,1,1,1], [1,1,1,0], [1,1,0,1], ]); M type(M) g = BipartiteGraph(M) g.plot()
[0 1 1 1] [1 1 1 0] [1 1 0 1] <type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
g = graphs.PetersenGraph() print "# vertices = order = " + str(g.order()); print "# edges = size = " + str(g.size()); g.show() # long time g.add_edges([[0,9],[1,5]]) g.show() # long time S = g.subgraph([5,6,7,8,9]) S.show() S = g.subgraph([0,1,2,3,4]) S.show()
# vertices = order = 10 # edges = size = 15
o|