Commit 4919791d authored by Fize Jacques's avatar Fize Jacques
Browse files

dealing with empty graph

1 merge request!5Add new version : Graph Extension, Parallelization, Graph Embedding, Performance enhanced
Showing with 115 additions and 111 deletions
+115 -111
...@@ -17,9 +17,13 @@ cdef class Graph: ...@@ -17,9 +17,13 @@ cdef class Graph:
self.is_node_attr=(True if node_attr_key else False) self.is_node_attr=(True if node_attr_key else False)
self.is_edge_attr=(True if edge_attr_key else False) self.is_edge_attr=(True if edge_attr_key else False)
if len(G) == 0: if len(G) ==0:
return 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.long),np.array([],dtype=np.long),np.array([],dtype=np.long)
self.nodes_idx,self.degree_per_attr,self.degree_per_attr_weighted={},{},{}
self.nodes_hash_set=set([])
else:
a,b=list(zip(*list(G.nodes(data=True)))) a,b=list(zip(*list(G.nodes(data=True))))
self.nodes_list,self.attr_nodes=list(a),list(b) self.nodes_list,self.attr_nodes=list(a),list(b)
if G.number_of_edges()>0: if G.number_of_edges()>0:
......
...@@ -78,7 +78,7 @@ setup( ...@@ -78,7 +78,7 @@ setup(
] ]
) )
#Clean cpp and compiled file #Clean cpp and compiled file
f=True f=False
if f: if f:
if os.path.exists("build"): if os.path.exists("build"):
shutil.rmtree("build") shutil.rmtree("build")
......
Supports Markdown
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