Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: MAO
Views: 74
Kernel: SageMath 8.1
M = designs.DesarguesianProjectivePlaneDesign(9) #(91, 10, 1) design B = M.blocks() #len(B) is 91 varieties = [] #collect all elements into varieties for i in range(91): varieties += [elm for elm in B[i]] varieties = list(set(varieties)) #Store all elements varieties.sort() #not important #map (a, b, c) --> n a natural number dic = {varieties[i]:i for i in range(len(varieties))} num = lambda x: dic[x] #return the numerical value B_new = [map(num,B[i]) for i in range(len(B))] #Each block has numerical entries which are easy to handle for indexing #This function returns 1 if an element i in the block j, 0 otherwise yesNo = lambda i, j, matrix: 1 if i in matrix[j] else 0 #Following the definition of the incidence matrix #Given blocks we would like to construct its incidence matrix incMat = lambda Mdesig: Matrix([[yesNo(i, j, Mdesig) for i in range(len(Mdesig))] for j in range(len(Mdesig))])#Return def graph_mat(matrix): """Returns the edges of a graph given its matrix""" length = matrix.dimensions()[0] Block = [] for i in range(length): for j in range(length): if matrix[i][j] == 1: Block.append((i,j)) Block.sort() #This is more complicated but it doesn't have a bug! return Block ####Experiment#### matrix = incMat(B_new) #incidence matrix G = Graph(graph_mat(matrix)) G_T = Graph(graph_mat(matrix.transpose())) print( G.is_isomorphic(G_T)) #True unfortunately </code>
/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/repl/ipython_kernel/__main__.py:35: DeprecationWarning: You created a graph with multiple edges from a list. Please set 'multiedges' to 'True' when you do so, as in the future the default behaviour will be to ignore those edges See http://trac.sagemath.org/15706 for details. /ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/repl/ipython_kernel/__main__.py:35: DeprecationWarning: You created a graph with loops from a list. Please set 'loops' to 'True' when you do so, as in the future the default behaviour will be to ignore those edges See http://trac.sagemath.org/15706 for details. /ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/repl/ipython_kernel/__main__.py:36: DeprecationWarning: You created a graph with multiple edges from a list. Please set 'multiedges' to 'True' when you do so, as in the future the default behaviour will be to ignore those edges See http://trac.sagemath.org/15706 for details. /ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/repl/ipython_kernel/__main__.py:36: DeprecationWarning: You created a graph with loops from a list. Please set 'loops' to 'True' when you do so, as in the future the default behaviour will be to ignore those edges See http://trac.sagemath.org/15706 for details.
True