Commit 5fd961a9 by Fize Jacques

### Add Weight integration in the GraphEditDistance Algorithm

`Add scikit-learn in the dependencies`
parent ebef6145
 ... ... @@ -8,6 +8,7 @@ cdef class AbstractGraphEditDistance(Base): cdef double edge_del cdef double edge_ins cdef np.ndarray cost_matrix cdef bint weighted cpdef double distance_ged(self,G,H) cdef list edit_costs(self,G,H) ... ...
 ... ... @@ -11,9 +11,9 @@ from ..base cimport intersection,union_ cdef class GraphEditDistance(AbstractGraphEditDistance): def __init__(self,node_del,node_ins,edge_del,edge_ins): def __init__(self,node_del,node_ins,edge_del,edge_ins,weighted=False): AbstractGraphEditDistance.__init__(self,node_del,node_ins,edge_del,edge_ins) self.weighted=weighted cpdef double substitute_cost(self, node1, node2, G, H): return self.relabel_cost(node1, node2, G, H) ... ... @@ -54,12 +54,12 @@ cdef class GraphEditDistance(AbstractGraphEditDistance): cdef double delete_cost(self, int i, int j, nodesG, G): if i == j: return self.node_del+(G.degree(nodesG[i])*self.edge_del) # Deleting a node implicate to delete in and out edges return self.node_del+(G.degree(nodesG[i],weight=("weight" if self.weighted else None))*self.edge_del) # Deleting a node implicate to delete in and out edges return sys.maxsize cdef double insert_cost(self, int i, int j, nodesH, H): if i == j: deg=H.degree(nodesH[j]) deg=H.degree(nodesH[j],weight=("weight" if self.weighted else None)) if isinstance(deg,dict):deg=0 return self.node_ins+(deg*self.edge_ins) else: ... ...
 ... ... @@ -55,8 +55,8 @@ setup( packages=["gmatch4py","gmatch4py.helpers"], ext_modules=extensions, cmdclass={'build_ext': build_ext}, setup_requires=["numpy","networkx","scipy"], install_requires=["numpy","networkx","scipy"], setup_requires=["numpy","networkx","scipy",'scikit-learn'], install_requires=["numpy","networkx","scipy",'scikit-learn'], version="0.2.2", classifiers=[ "Programming Language :: Python :: 3", ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!