python复杂网络库networkx:算法
2017-01-04 16:22
1031 查看
http://blog.csdn.net/pipisorry/article/details/54020333
all_shortest_paths
shortest_path_length
average_shortest_path_length
has_path
Advanced Interface
Dense Graphs
A* Algorithm
[Shortest Paths]
Note:nx.all_simple_paths只能迭代一次。
[Link Analysis]
Note: 返回的基本都是iterator of 3-tuples in the form (u, v, p)。iterator只能迭代一次,否则为空了。
不指定ebunch的话就是计算所有没有边的点。If ebunchis None then all non-existent edges in the graph will be used.
[Link Prediction]
连通子图计算示例
Strong connectivity
Weak connectivity
Attracting components
Biconnected components
Semiconnectedness
[Components]
[Connectivity]
[Depth First Search]
广度优先遍历
[Breadth First Search]
边的深度优先遍历
[Depth First Search on Edges]
[Traversal]
皮皮blog
networkx算法示例
使用networkx计算所有路径及路径距离
[jupyter]
[python—networkx:求图的平均路径长度并画出直方图]
皮皮blog
from: http://blog.csdn.net/pipisorry/article/details/54020333
ref: [Algorithms]
[Networkx Reference]*[NetworkX documentation]*[doc NetworkX Examples]*[NetworkX Home]
Networks算法Algorithms
最短路径Shortest Paths
shortest_pathall_shortest_paths
shortest_path_length
average_shortest_path_length
has_path
Advanced Interface
Dense Graphs
A* Algorithm
[Shortest Paths]
简单路径Simple Paths
all_simple_paths(G, source, target[, cutoff]) | Generate all simple paths in the graph G from source to target. |
shortest_simple_paths(G, source, target[, ...]) | Generate all simple paths in the graph G from source to target, starting from shortest ones. |
链接分析Link Analysis
PageRank Hits[Link Analysis]
链接预测Link Prediction
链接预测算法
resource_allocation_index(G[, ebunch]) | Compute the resource allocation index of all node pairs in ebunch. |
jaccard_coefficient(G[, ebunch]) | Compute the Jaccard coefficient of all node pairs in ebunch. |
adamic_adar_index(G[, ebunch]) | Compute the Adamic-Adar index of all node pairs in ebunch. |
preferential_attachment(G[, ebunch]) | Compute the preferential attachment score of all node pairs in ebunch. |
cn_soundarajan_hopcroft(G[, ebunch, community]) | Count the number of common neighbors of all node pairs in ebunch using community information. |
ra_index_soundarajan_hopcroft(G[, ebunch, ...]) | Compute the resource allocation index of all node pairs in ebunch using community information. |
within_inter_cluster(G[, ebunch, delta, ...]) | Compute the ratio of within- and inter-cluster common neighbors of all node pairs in ebunch. |
不指定ebunch的话就是计算所有没有边的点。If ebunchis None then all non-existent edges in the graph will be used.
单纯cn个数的计算
def commonNeighbor(G, ebunch=None): ''' compute num of common neighbor ''' import networkx as nx if ebunch is None: ebunch = nx.non_edges(G) def predict(u, v): cnbors = list(nx.common_neighbors(G, u, v)) return len(cnbors) return ((u, v, predict(u, v)) for u, v in ebunch)
[Link Prediction]
组件Components
connectivity连通性
连通子图Connected componentsis_connected(G) | Return True if the graph is connected, false otherwise. |
number_connected_components(G) | Return the number of connected components. |
connected_components(G) | Generate connected components. |
connected_component_subgraphs(G[, copy]) | Generate connected components as subgraphs. |
node_connected_component(G, n) | Return the nodes in the component of graph containing node n. |
from networkx.algorithms import traversal, components weighted_edges = pd.read_csv(os.path.join(CWD, 'middlewares/network_reid.txt'), sep=',', header=None).values.tolist() g = nx.Graph() g.add_weighted_edges_from(weighted_edges) # print('#connected_components of g: {}'.format(nx.number_connected_components(g))) component_subgs = components.connected_component_subgraphs(g) for component_subg in component_subgs: print(component_subg.nodes_list()[:5])
Strong connectivity
Weak connectivity
Attracting components
Biconnected components
Semiconnectedness
[Components]
Connectivity
Connectivity and cut algorithms[Connectivity]
遍历Traversal
深度优先遍历[Depth First Search]
广度优先遍历
[Breadth First Search]
边的深度优先遍历
[Depth First Search on Edges]
[Traversal]
皮皮blog
networkx算法示例
使用networkx计算所有路径及路径距离
[jupyter][python—networkx:求图的平均路径长度并画出直方图]
社区发现
[复杂网络社区结构发现算法-基于python networkx clique渗透算法 ]皮皮blog
from: http://blog.csdn.net/pipisorry/article/details/54020333
ref: [Algorithms]
[Networkx Reference]*[NetworkX documentation]*[doc NetworkX Examples]*[NetworkX Home]
相关文章推荐
- 复杂网络社区结构发现算法-基于python networkx clique渗透算法
- python复杂网络库networkx:算法
- python复杂网络库networkx:算法
- python下的复杂网络编程包networkx的使用(摘抄)
- 复杂网络K-Shell算法及其Python实现
- python复杂网络处理模块networkx
- python复杂网络库networkx:绘图draw
- python下的复杂网络编程包networkx的安装及使用
- python复杂网络库networkx:绘图draw
- python复杂网络库networkx:基础
- python复杂网络分析库NetworkX
- python下的复杂网络编程包networkx、matplotlib、numpy安装及报错解决方案
- python复杂网络库networkx:基础
- python复杂网络库networkx:绘图draw
- python复杂网络分析库NetworkX
- python复杂网络库networkx:基础
- 用 python绘图及网络分析(win64下matplotlib,networkx安装方法)
- 基于Levenberg-Marquardt训练算法的BP网络Python实现
- 基于Levenberg-Marquardt训练算法的BP网络Python实现
- 基于Levenberg-Marquardt训练算法的BP网络Python实现