NetworkX

用 Python 进行网络分析。(Network Analysis in Python)

Github星跟踪图

NetworkX

NetworkX 是一个 Python 包,用于创建、操作和研究复杂网络的结构、动态和功能。

简单的例子

找到无向图中两个节点之间的最短路径:

>>> import networkx as nx
>>> G = nx.Graph()
>>> G.add_edge('A', 'B', weight=4)
>>> G.add_edge('B', 'D', weight=2)
>>> G.add_edge('A', 'C', weight=3)
>>> G.add_edge('C', 'D', weight=4)
>>> nx.shortest_path(G, 'A', 'D', weight='weight')
['A', 'B', 'D']

安装

安装最新版本的 NetworkX:

  $ pip install networkx

安装所有可选的依赖项:

  $ pip install networkx [all]

有关更多详细信息,请参阅 INSTALL.rst 。

错误

请在 这里 报告你发现的任何错误。或者,甚至更好的是,在 GitHub 上分叉仓库并创建一个拉取请求(PR)。我们欢迎所有的改动,无论大小,如果你是git新手,我们会帮助你创建PR(只需在问题上询问和/或查看CONTRIBUTING.rst)。

许可证

根据 3-clause BSD 许可证发布(请参阅 LICENSE.txt )::

版权所有(C)2004-2018 NetworkX Developers

Copyright (C) 2004-2021 NetworkX Developers
Aric Hagberg <hagberg@lanl.gov>
Dan Schult <dschult@colgate.edu>
Pieter Swart <swart@lanl.gov>


主要指标

概览
名称与所有者networkx/networkx
主编程语言Python
编程语言Python (语言数: 1)
平台Linux, Mac, Windows
许可证Other
所有者活动
创建于2010-09-06 00:53:44
推送于2025-05-19 04:54:19
最后一次提交
发布数97
最新版本名称networkx-3.5rc0 (发布于 2025-05-09 08:41:17)
第一版名称networkx-0.23 (发布于 )
用户参与
星数15.8k
关注者数282
派生数3.4k
提交数8k
已启用问题?
问题数3274
打开的问题数182
拉请求数3143
打开的拉请求数190
关闭的拉请求数808
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

NetworkX

.. image:: https://img.shields.io/pypi/v/networkx.svg
:target: https://pypi.org/project/networkx/

.. image:: https://img.shields.io/pypi/pyversions/networkx.svg
:target: https://pypi.org/project/networkx/

.. image:: https://travis-ci.org/networkx/networkx.svg?branch=master
:target: https://travis-ci.org/networkx/networkx

.. image:: https://ci.appveyor.com/api/projects/status/github/networkx/networkx?branch=master&svg=true
:target: https://ci.appveyor.com/project/dschult/networkx-pqott

.. image:: https://codecov.io/gh/networkx/networkx/branch/master/graph/badge.svg
:target: https://codecov.io/gh/networkx/networkx

NetworkX is a Python package for the creation, manipulation,
and study of the structure, dynamics, and functions
of complex networks.

Simple example

Find the shortest path between two nodes in an undirected graph:

.. code:: python

>>> import networkx as nx
>>> G = nx.Graph()
>>> G.add_edge('A', 'B', weight=4)
>>> G.add_edge('B', 'D', weight=2)
>>> G.add_edge('A', 'C', weight=3)
>>> G.add_edge('C', 'D', weight=4)
>>> nx.shortest_path(G, 'A', 'D', weight='weight')
['A', 'B', 'D']

Install

Install the latest version of NetworkX::

$ pip install networkx

Install with all optional dependencies::

$ pip install networkx[all]

For additional details, please see INSTALL.rst.

Bugs

Please report any bugs that you find here <https://github.com/networkx/networkx/issues>.
Or, even better, fork the repository on GitHub <https://github.com/networkx/networkx>

and create a pull request (PR). We welcome all changes, big or small, and we
will help you make the PR if you are new to git (just ask on the issue and/or
see CONTRIBUTING.rst).

License

Released under the 3-Clause BSD license (see LICENSE.txt)::

Copyright (C) 2004-2020 NetworkX Developers
Aric Hagberg hagberg@lanl.gov
Dan Schult dschult@colgate.edu
Pieter Swart swart@lanl.gov