def obtain_edit_distance_from_eqc_and_H(H,eqc):
	eqcgraphs = []
	for graphstr in eqc:
		graph = comparison.num2CG(graphstr,len(H))
		eqcgraphs.append(graph)
	hamming_distance = []
	for graph in eqcgraphs:
		hamming_distance.append(determine_edit_distance(graph,H))
	return hamming_distance
def obtain_edit_distance_from_eqc_only(H,eqc):
	eqcgraphs = []
	for graphstr in eqc:
		graph = comparison.num2CG(graphstr,len(H))
		eqcgraphs.append(graph)
	hamming_distance = []
	for comb in combinations(eqcgraphs,2):
		hamming_distance.append(determine_edit_distance(comb[0],comb[1]))
	return hamming_distance
def obtain_out_degrees_from_eqc(H,eqc):
	eqcgraphs = []
	for graphstr in eqc:
		graph = comparison.num2CG(graphstr,len(H))
		eqcgraphs.append(graph)
	outdegrees = []
	for graph in eqcgraphs:
		outdegrees.append(determine_out_degrees(graph))
	return outdegrees
Beispiel #4
0
def compat(G):
    n = len(G)
    num = g2num(G)
    # sample all the graph for gStar
    star_l = all_undersamples(G)
    hits = {}
    # brute force all graphs
    for i in range(0, 2**(n**2)):
        tmpG = num2CG(i, n)
        tmp_l = all_undersamples(tmpG)
        c = compatible(tmp_l, star_l)
        if len(sum(c)) > 0: hits[i] = c
    return hits
Beispiel #5
0
def compat(G):
    n = len(G)
    num = g2num(G)
    # sample all the graph for gStar
    star_l = all_undersamples(G)
    hits = {}
    # brute force all graphs
    for i in range(0, 2 ** (n ** 2)):
        tmpG = num2CG(i, n)
        tmp_l = all_undersamples(tmpG)
        c = compatible(tmp_l, star_l)
        if len(sum(c)) > 0: hits[i] = c
    return hits
Beispiel #6
0
def cc_all(i, nodes, steps):
    # print i
    g = num2CG(i, nodes)
    return i, cc_undersamples(g, steps=steps)
Beispiel #7
0
def iall(i, nodes):
    print i
    g = num2CG(i, nodes)
    return compact_call_undersamples(g)
Beispiel #8
0
def ilength(i, nodes):
    print i
    g = num2CG(i, nodes)
    return len(call_undersamples(g))
Beispiel #9
0
def icompat(i, nodes):
    print i
    g = num2CG(i, nodes)
    return compat(g)
Beispiel #10
0
def tuple2graph(t, n):
    g = num2CG(t[0], n)
    return add_bd_by_adj(g, num2adj(t[1], n))
Beispiel #11
0
def cc_all(i, nodes, steps):
    # print i
    g = num2CG(i, nodes)
    return i, cc_undersamples(g, steps=steps)
Beispiel #12
0
def iall(i, nodes):
    print i
    g = num2CG(i, nodes)
    return compact_call_undersamples(g)
Beispiel #13
0
def ilength(i, nodes):
    print i
    g = num2CG(i, nodes)
    return len(call_undersamples(g))
Beispiel #14
0
def icompat(i, nodes):
    print i
    g = num2CG(i, nodes)
    return compat(g)
Beispiel #15
0
def tuple2graph(t, n):
    g = num2CG(t[0], n)
    return add_bd_by_adj(g, num2adj(t[1], n))