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-06-08 14:58:39
最后一次提交
發布數98
最新版本名稱networkx-3.5 (發布於 2025-05-29 04:31:46)
第一版名稱networkx-0.23 (發布於 )
用户参与
星數15.8k
關注者數281
派生數3.4k
提交數8k
已啟用問題?
問題數3286
打開的問題數186
拉請求數3159
打開的拉請求數206
關閉的拉請求數817
项目设置
已啟用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