math1um / objects-invariants-properties

Objects, Invariants and Properties for Graph Theory (GT) automated conjecturing: in particular with the Sage program CONJECTURING: http://nvcleemp.github.io/conjecturing/
GNU General Public License v3.0
14 stars 6 forks source link

Add graph generator: makes pair of isomorhic random graphs with different adjaceny matrices #635

Open math1um opened 3 years ago

math1um commented 3 years ago

Is there a section for graph generators in GT?

(if not there probably should be)

otherwise maybee put this function in AUXILIARY

def make_isomorphic_pair(n): #makes pair of isomorphic graphs of order n with different adjacency matrices
    g1=graphs.RandomGNP(n,.5)
    P=Permutations(g1.vertices()).random_element()
    a1=g1.adjacency_matrix()
    a2 = matrix(n,n,(n*n)*[0])
    for i in range(n):
        for j in range(n):
            if a1[i][j]==1:
                a2[P[i],P[j]] = 1
    g2=Graph(a2)
    return g1,g2