Commit ed01db41 authored by Fize Jacques's avatar Fize Jacques

Debug Bag of Cliques + Debug GED

parent bf1cb5e1
......@@ -80,13 +80,16 @@ cdef class BagOfCliques(Base):
def clique2str(self,cliques):
return "".join(sorted(cliques))
try:
return "".join(sorted(cliques))
except:
return "".join(sorted(list(map(str,cliques))))
def transform_clique_vocab(self,clique_vocab):
cdef dict new_vocab={}
cdef int len_voc=len(clique_vocab)
for c in range(len_voc):
print(c)
#print(c)
new_vocab[self.clique2str(clique_vocab[c])]=c
return new_vocab
......@@ -115,7 +118,7 @@ cdef class BagOfCliques(Base):
cdef np.ndarray vector
cdef list cliques
for g in range(len(graphs)):
sys.stdout.write("\r{0}/{1}".format(g,len(graphs)))
#sys.stdout.write("\r{0}/{1}".format(g,len(graphs)))
gr = graphs[g]
vector = np.zeros(l_v)
cliques = list(nx.enumerate_all_cliques(nx.Graph(gr)))
......
......@@ -19,6 +19,8 @@ cdef class GraphEditDistance(AbstractGraphEditDistance):
def relabel_cost(self, node1, node2, G, H):
if node1 != node2:
if len(G.edges(node1)) == 0 and len(H.edges(node2)) ==0:
return self.node_del+self.node_ins
R = nx.create_empty_copy(G)
R.add_edges_from(G.edges(node1,data=True))
nx.relabel_nodes(R,{node1:node2},copy=False)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment