def addGraphRoot(GA, GB, r1, r2):
    r = [i.copy() for i in GB.pos]
    x = (GA.pos[r1][0] - GB.pos[r2][0])
    y = (GA.pos[r1][1] - GB.pos[r2][1])
    for z in range(len(r)):
        r[z][0] += x
        r[z][1] += y
    del r[r2]
    G = GB.Mat.copy()
    rt = G[:, r2]
    G = np.delete(G, r2, 0)
    G = np.delete(G, r2, 1)
    GA.addNodes(r)
    GA.Mat[((GA.size - GB.size) + 1):GA.size, ((GA.size - GB.size) + 1):GA.size] = G
    for (pos, ed) in enumerate(rt):
        if (ed == 1):
            GA.addEdges([r1], [((GA.size - GB.size) + pos)])
def addGraphRoot(GA, GB, r1, r2):
    r = [i.copy() for i in GB.pos]
    x = (GA.pos[r1][0] - GB.pos[r2][0])
    y = (GA.pos[r1][1] - GB.pos[r2][1])
    for z in range(len(r)):
        r[z][0] += x
        r[z][1] += y
    del r[r2]
    G = GB.Mat.copy()
    rt = G[:, r2]
    G = np.delete(G, r2, 0)
    G = np.delete(G, r2, 1)
    GA.addNodes(r)
    GA.Mat[((GA.size - GB.size) + 1):GA.size, ((GA.size - GB.size) + 1):GA.size] = G
    for (pos, ed) in enumerate(rt):
        if (ed == 1):
            GA.addEdges([r1], [((GA.size - GB.size) + pos)])