http://blog.csdn.net/pipisorry/article/details/54020333

Networks算法Algorithms

最短路径Shortest Paths

shortest_path

all_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.

Note:nx.all_simple_paths只能迭代一次。

链接分析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.

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.

单纯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 components

is_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:
])

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:算法的更多相关文章

  1. python复杂网络库networkx:基础

    http://blog.csdn.net/pipisorry/article/details/49839251 其它复杂网络绘图库 [SNAP for python] [ArcGIS,Python,网 ...

  2. python复杂网络库networkx:绘图draw

    http://blog.csdn.net/pipisorry/article/details/54291831 networkx使用matplotlib绘制函数 draw(G[, pos, ax, h ...

  3. Python 并发网络库

    Python 并发网络库 Tornado VS Gevent VS Asyncio Tornado:并发网络库,同时也是一个 web 微框架 Gevent:绿色线程(greenlet)实现并发,猴子补 ...

  4. python复杂网络分析库NetworkX

    NetworkX是一个用Python语言开发的图论与复杂网络建模工具,内置了常用的图与复杂网络分析算法,可以方便的进行复杂网络数据分析.仿真建模等工作.networkx支持创建简单无向图.有向图和多重 ...

  5. Python常用的库简单介绍一下

    Python常用的库简单介绍一下fuzzywuzzy ,字符串模糊匹配. esmre ,正则表达式的加速器. colorama 主要用来给文本添加各种颜色,并且非常简单易用. Prettytable ...

  6. 使用python网络库下载

    下载1000次网页资源 1,普通循环方式下载1000次,非常慢 #!/usr/bin/python # -*- coding: utf-8 -*- import sys import os impor ...

  7. python基于协程的网络库gevent、eventlet

    python网络库也有了基于协程的实现,比较著名的是 gevent.eventlet 它两之间的关系可以参照 Comparing gevent to eventlet, 本文主要简单介绍一下event ...

  8. day-9 sklearn库和python自带库实现最近邻KNN算法

    K最近邻(k-Nearest Neighbor,KNN)分类算法,是一个理论上比较成熟的方法,也是最简单的机器学习算法之一.该方法的思路是:如果一个样本在特征空间中的k个最相似(即特征空间中最邻近)的 ...

  9. python爬虫#网络请求requests库

    中文文档 http://docs.python-requests.org/zh_CN/latest/user/quickstart.html requests库 虽然Python的标准库中 urlli ...

随机推荐

  1. 遗传算法详解(LINGO及MatlabGA工具箱求解实现)

    遗传算法 1.前言 遗传算法是一种基于生物界自然群体遗传进化机制的自适应全局优化概率搜索算法.它与传统算法不同,不依赖梯度信息,而是通过模拟自然进化过程来搜索最优解. 例子:兔子的遗传进化 有人说,现 ...

  2. requests之一:HTTP OAUTH认证(1)图形解释流程

  3. C#之读写压缩文件

    在处理文件时,常常会发现文件中有许多空格,耗尽了硬盘空间,.net的类提供了GZIP/Deflate算法可以压缩文件.这里只介绍了文件的压缩,但在实际应用更多的是压缩文件夹 压缩文件 解压文件 可以使 ...

  4. CSS常用字体属性(多出的文本隐藏,或者以省略号的形式显示)和背景样式以及背景图的2个不常用属性:background-origin和background-clip

    (一)常用的字体属性: font-weight: 属性值100-900  400等于正常 700等于bold ,数值越大,越粗 font-size:字体大小,单位可以为px或者% font-famil ...

  5. jQuery中的事件监听小记

    一,一个事件监听的简便写法 最近发现一个jQuery中事件监听的简洁写法,感觉方便好多.同时也深感自己基础薄弱,好多东西竟然都模棱两可.因此,记录的同时,也对jQuery事件监听做个小的总结 原文链接 ...

  6. 机器学习技法:14 Radial Basis Function Network

    Roadmap RBF Network Hypothesis RBF Network Learning k-Means Algorithm k-Means and RBF Network in Act ...

  7. 获取Avrix上Computer Vision and Pattern Recognition的论文,进一步进行统计分析。

    此文主要记录我在18年寒假期间,收集Avrix论文的总结 寒假生活题外   在寒假期间,爸妈每天让我每天跟着他们6点起床,一起吃早点收拾,每天7点也就都收拾差不多.   早晨的时光是人最清醒的时刻,而 ...

  8. 【BZOJ1951】【SDOI2010】古代猪文

    Background "在那山的那边海的那边有一群小肥猪.他们活泼又聪明,他们调皮又灵敏.他们自由自在生活在那绿色的大草坪,他们善良勇敢相互都关心--" --选自猪王国民歌 很久很 ...

  9. bzoj 1426:收集邮票 求平方的期望

    显然如果收集了k天,ans=k*(k+1)/2=(k^2+k)/2.那么现在要求的就是这个东西的期望. 设f[i]表示已有i张邮票,收集到n张的期望次数,g[i]表示已有i张邮票,收集到n张的次数的平 ...

  10. ●BZOJ 2743 [HEOI2012]采花

    题链: http://www.lydsy.com/JudgeOnline/problem.php?id=2743 题解: 树状数组,离线 求区间里面有多少种出现次数大于等于 2 的颜色. 类似某一个题 ...