python -networkx 基本知识
图论
平均路径长度:所有可能节点对应的最短路径长度的平均值
nexworkx
python -networkx 基本知识
nx.from_edgelist (el,directed=TRUE)
el:边列表,两列矩阵,字符或者数字
directed:是否创建有向图
nexworkx.find_cliques(G):搜索图中最大团
nx.core_network(graph) #搜索节点最大k-core
nx.add_edge('顶点u","顶点v") #向graph中添加边
Graph.has_node(n)Return True if the graph contains the node n.
Graph.__contains__(n)Return True if n is a node, False otherwise.
Graph.has_edge(u, v)Return True if the edge (u,v) is in the graph.
Graph.order()Return the number of nodes in the graph.
Graph.number_of_nodes()Return the number of nodes in the graph.
Graph.__len__()Return the number of nodes.
Graph.degree([nbunch, weight])Return the degree of a node or nodes.
Graph.degree_iter([nbunch, weight])Return an iterator for (node, degree).
Graph.size([weight])Return the number of edges.
Graph.number_of_edges([u, v])Return the number of edges between two nodes.
Graph.nodes_with_selfloops()Return a list of nodes with self loops.
Graph.selfloop_edges([data, default])Return a list of selfloop edges.
Graph.number_of_selfloops()Return the number of selfloop edges.
作者:Forget_ever
链接:https://www.jianshu.com/p/e543dc63454f
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。