python -networkx 基本知識(shí)

? 圖論

平均路徑長度:所有可能節(jié)點(diǎn)對(duì)應(yīng)的最短路徑長度的平均值


nexworkx


圖片發(fā)自簡書App


nx.from_edgelist (el,directed=TRUE)

el:邊列表,兩列矩陣,字符或者數(shù)字

directed:是否創(chuàng)建有向圖


nexworkx.find_cliques(G):搜索圖中最大團(tuán)

nx.core_network(graph)? #搜索節(jié)點(diǎn)最大k-core

nx.add_edge('頂點(diǎn)u","頂點(diǎn)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

鏈接:http://www.itdecent.cn/p/e543dc63454f

來源:簡書

簡書著作權(quán)歸作者所有,任何形式的轉(zhuǎn)載都請(qǐng)聯(lián)系作者獲得授權(quán)并注明出處。



最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容