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
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
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)) deg_struct[t] = np.linalg.norm(np.sort(d1_struct) - np.sort(d2_struct))