def generateGraph(nnodes, edgeprob, directed, pathtosave):
if os.path.exists(pathtosave):
matrix = np.loadtxt(pathtosave)
else:
shape = (nnodes,nnodes)
G = nx.fast_gnp_random_graph(n=nnodes, p=edgeprob, directed=directed)
matrix = nx.adjacency_matrix(G)
if pathtosave is not None:
np.savetxt(pathtosave, matrix.toarray(), fmt='%d',)
print nx.info(G)
matrix = matrix.toarray()
return matrix
#######################################################################
# Main
#######################################################################
example_synthetic_timing_netsize_nodes_ernos_renyi.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录