Esempio n. 1
0
def estThresDeg(n, k, p, gamma, T):
    deg_null = np.zeros(T)
    deg_struct = np.zeros(T)

    for t in range(T):
        (G1_null, G2_null) = genNull(n, p, gamma)
        (G1_struct, G2_struct) = genStruct(n, p, gamma)

        deg_null[t] = degreeSeq(G1_null, G2_null)
        deg_struct[t] = degreeSeq(G1_struct, G2_struct)

    thres = estThres(deg_struct, deg_null, T)

    return thres
Esempio n. 2
0
def estThresPath(n, k, p, gamma, T, mean, std):

    cor_null = np.zeros(T)
    cor_struct = np.zeros(T)

    for t in range(T):
        (G1_null, G2_null) = genNull(n, p, gamma)
        (G1_struct, G2_struct) = genStruct(n, p, gamma)

        cor_null[t] = calCorPath(G1_null, G2_null, n, k, mean, std)
        cor_struct[t] = calCorPath(G1_struct, G2_struct, n, k, mean, std)

    thres = estThres(cor_null, cor_struct, T)

    return thres
Esempio n. 3
0
def estPathCount(n, k, p, gamma, T):

    c = np.zeros([T, k])

    for t in range(T):
        (G1, G2) = genNull(n, p, gamma)
        c[t, :] = np.sum(pathCount(G1, n, k), axis=1)

    mean = np.zeros(k)
    std = np.zeros(k)

    for i in range(k):
        mean[i] = np.average(c[:, i])
        std[i] = np.std(c[:, i])

    return mean, std
Esempio n. 4
0
def estCycleCount(n, k, p, gamma, T):

    c = np.zeros([T, k - 1])

    for t in range(T):
        (G1, G2) = genNull(n, p, gamma)
        c[t, :] = np.sum(cycleCount(G1, n, k), axis=1)
#        c[t,:] = cycleCount(G1,n,k)

    mean = np.zeros(k - 1)
    std = np.zeros(k - 1)

    for i in range(k - 1):
        mean[i] = np.average(c[:, i])
        std[i] = np.std(c[:, i])

    return mean, std
Esempio n. 5
0
T = 50

v1_null = np.zeros([k - 1, T])
v2_null = np.zeros([k - 1, T])
v3_null = np.zeros([k - 1, T])
v1_struct = np.zeros([k - 1, T])
v2_struct = np.zeros([k - 1, T])

deg_null = np.zeros(T)
deg_struct = np.zeros(T)

(mean_est, std_est) = estCycleCount(n, k, p, gamma, 100)

for t in range(T):

    (G1_null, G2_null) = genNull(n, p, gamma)
    (G3_null, G4_null) = genNull(n, p, gamma)
    (G1_struct, G2_struct) = genStruct(n, p, gamma)

    v1_null[:, t] = np.sum(cycleCount(G1_null, n, k), axis=1)
    v2_null[:, t] = np.sum(cycleCount(G2_null, n, k), axis=1)
    v3_null[:, t] = np.sum(cycleCount(G3_null, n, k), axis=1)
    v1_struct[:, t] = np.sum(cycleCount(G1_struct, n, k), axis=1)
    v2_struct[:, t] = np.sum(cycleCount(G2_struct, n, k), axis=1)

    d1_null = degreeCount(G1_null)
    d2_null = degreeCount(G2_null)
    d1_struct = degreeCount(G1_struct)
    d2_struct = degreeCount(G2_struct)
    # degree sequence
    deg_null[t] = np.linalg.norm(np.sort(d1_null) - np.sort(d2_null))
Esempio n. 6
0
n = 100  # number of vertices
p = 0.6  # np is the average degree
gamma = 0.85  # noise
k = 3
T = 100

error_null = np.zeros(T)
error_struct = np.zeros(T)

deg_null = np.zeros(T)
deg_struct = np.zeros(T)

for t in range(T):

    (G1_null, G2_null) = genNull(n, p, gamma)
    (G1_struct, G2_struct) = genStruct(n, p, gamma)

    v1_null = cycleCount(G1_null, n, k)
    v2_null = cycleCount(G2_null, n, k)
    v1_struct = cycleCount(G1_struct, n, k)
    v2_struct = cycleCount(G2_struct, n, k)

    d1_null = degreeCount(G1_null)
    d2_null = degreeCount(G2_null)
    d1_struct = degreeCount(G1_struct)
    d2_struct = degreeCount(G2_struct)

    # degree sequence
    deg_null[t] = np.linalg.norm(np.sort(d1_null) - np.sort(d2_null))
    deg_struct[t] = np.linalg.norm(np.sort(d1_struct) - np.sort(d2_struct))