From 051efb3fbe6b12d51a8c4fedd15c0cbea42edbee Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Thu, 25 Apr 2024 16:07:30 +0200 Subject: [PATCH] Numpy type fix --- gmatch4py/ged/greedy_edit_distance.pyx | 2 +- gmatch4py/graph.pyx | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gmatch4py/ged/greedy_edit_distance.pyx b/gmatch4py/ged/greedy_edit_distance.pyx index 9bdd2c4..f3fa925 100644 --- a/gmatch4py/ged/greedy_edit_distance.pyx +++ b/gmatch4py/ged/greedy_edit_distance.pyx @@ -21,7 +21,7 @@ cdef class GreedyEditDistance(GraphEditDistance): cdef list edit_costs(self, G, H): cdef np.ndarray cost_matrix=self.create_cost_matrix(G,H) - cdef np.ndarray cost_matrix_2=cost_matrix.copy().astype(np.double) + cdef np.ndarray cost_matrix_2=cost_matrix.copy().astype(np.float64) cdef list psi=[] for i in range(len(cost_matrix)): phi_i=np.argmin(cost_matrix_2[i]) diff --git a/gmatch4py/graph.pyx b/gmatch4py/graph.pyx index 1ed87b5..ea6220c 100644 --- a/gmatch4py/graph.pyx +++ b/gmatch4py/graph.pyx @@ -112,9 +112,9 @@ cdef class Graph: self.nodes_degree_in=np.array(degree_in) self.nodes_degree_out=np.array(degree_out) - self.nodes_degree_weighted=np.array(degree_all_weighted).astype(np.double) - self.nodes_degree_in_weighted=np.array(degree_in_weighted).astype(np.double) - self.nodes_degree_out_weighted=np.array(degree_out_weighted).astype(np.double) + self.nodes_degree_weighted=np.array(degree_all_weighted).astype(np.float64) + self.nodes_degree_in_weighted=np.array(degree_in_weighted).astype(np.float64) + self.nodes_degree_out_weighted=np.array(degree_out_weighted).astype(np.float64) # EDGE INFO INIT @@ -371,7 +371,7 @@ cdef class Graph: def __init_empty__(self): self.nodes_list,self.nodes_attr_list,self.nodes_hash,self.nodes_weight,self.attr_nodes=[],[],[],[],[] - self.nodes_degree,self.nodes_degree_in,self.nodes_degree_out,self.nodes_degree_weighted,self.nodes_degree_in_weighted,self.nodes_degree_out_weighted=np.array([],dtype=np.long),np.array([],dtype=np.long),np.array([],dtype=np.long),np.array([],dtype=np.double),np.array([],dtype=np.double),np.array([],dtype=np.double) + self.nodes_degree,self.nodes_degree_in,self.nodes_degree_out,self.nodes_degree_weighted,self.nodes_degree_in_weighted,self.nodes_degree_out_weighted=np.array([],dtype=np.int64),np.array([],dtype=np.int64),np.array([],dtype=np.int64),np.array([],dtype=np.float64),np.array([],dtype=np.float64),np.array([],dtype=np.float64) self.nodes_idx,self.degree_per_attr,self.degree_per_attr_weighted={},{},{} self.nodes_hash_set=set([]) self.number_of_nodes = 0 @@ -385,5 +385,3 @@ cdef class Graph: self.edges_weight={} self.edges_hash_map={} self.attr_edges=[] - - \ No newline at end of file