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

dealing with empty graph

parent ecb66c9b
......@@ -17,9 +17,13 @@ cdef class Graph:
self.is_node_attr=(True if node_attr_key else False)
self.is_edge_attr=(True if edge_attr_key else False)
if len(G) == 0:
return
if len(G) ==0:
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))))
self.nodes_list,self.attr_nodes=list(a),list(b)
if G.number_of_edges()>0:
......
......@@ -78,7 +78,7 @@ setup(
]
)
#Clean cpp and compiled file
f=True
f=False
if f:
if os.path.exists("build"):
shutil.rmtree("build")
......
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