networkx

Python package for creating and manipulating graphs and networks

96 个版本 Python !=3.14.1,>=3.11
安装
pip install networkx
poetry add networkx
pipenv install networkx
conda install networkx
描述

NetworkX

.. image:: https://github.com/networkx/networkx/actions/workflows/test.yml/badge.svg?branch=main :target: https://github.com/networkx/networkx/actions/workflows/test.yml

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

.. image:: https://img.shields.io/pypi/l/networkx.svg? :target: https://github.com/networkx/networkx/blob/main/LICENSE.txt

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

.. image:: https://img.shields.io/github/labels/networkx/networkx/good%20first%20issue?color=green&label=contribute :target: https://github.com/networkx/networkx/contribute

.. image:: https://insights.linuxfoundation.org/api/badge/health-score?project=networkx :target: https://insights.linuxfoundation.org/project/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:: pycon

>>> 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 released version of NetworkX:

.. code:: shell

$ pip install networkx

Install with all optional dependencies:

.. code:: shell

$ pip install networkx[default]

For additional details, please see the installation guide <https://networkx.org/documentation/stable/install.html>_.

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 the contributor guide <https://networkx.org/documentation/latest/developer/contribute.html>_).

License

Released under the 3-clause BSD license <https://github.com/networkx/networkx/blob/main/LICENSE.txt>_::

Copyright (c) 2004-2025, NetworkX Developers
Aric Hagberg <hagberg@lanl.gov>
Dan Schult <dschult@colgate.edu>
Pieter Swart <swart@lanl.gov>
版本列表
3.6.1 2025-12-08
3.6 2025-11-24
3.5 2025-05-29
3.4.2 2024-10-21
3.4.1 2024-10-11
3.4 2024-10-10
3.3 2024-04-06
3.2.1 2023-10-28
3.2 2023-10-19
3.1 2023-04-04
3.0 2023-01-08
3.6rc0 2025-11-04
3.5rc0 2025-05-09
3.4rc0 2024-10-06
3.3rc0 2024-03-22
3.2rc0 2023-10-11
3.1rc0 2023-03-30
3.0rc1 2022-11-11
3.0b1 2022-10-12
2.8.8 2022-11-01
2.8.7 2022-10-01
2.8.6 2022-08-22
2.8.5 2022-07-18
2.8.4 2022-06-14
2.8.3 2022-06-04
2.8.2 2022-05-21
2.8.1 2022-05-18
2.8 2022-04-09
2.8.1rc1 2022-05-13
2.7.1 2022-03-05
2.7 2022-02-28
2.6.3 2021-09-09
2.6.2 2021-07-27
2.6.1 2021-07-08
2.6 2021-07-08
2.5.1 2021-04-03
2.5 2020-08-22
2.4 2019-10-17
2.3 2019-04-11
2.2 2018-09-19
2.1 2018-01-22
2.0 2017-09-20
2.8rc1 2022-04-05
2.7rc1 2022-02-19
2.6rc2 2021-06-23
2.6rc1 2021-05-31
2.5rc1 2020-08-16
2.4rc2 2019-10-16
2.4rc1 2019-10-13
2.3rc4 2019-04-11
2.3rc3 2019-04-04
2.2rc1 2018-09-11
1.11 2016-01-30
1.10 2015-08-02
1.9.1 2014-09-20
1.9 2014-06-21
1.8.1 2013-08-04
1.8 2013-07-28
1.7 2012-07-05
1.6 2011-11-22
1.5 2011-06-04
1.4 2011-01-23
1.3 2010-08-29
1.2 2010-08-01
1.1 2010-04-22
1.0.1 2010-01-11
1.0 2010-01-11
1.9rc1 2014-06-06
1.8rc1 2013-07-22
1.7rc1 2012-06-13
1.6rc1 2011-11-15
1.5rc1 2011-05-21
1.4rc1 2011-01-17
1.3rc1 2010-08-21
1.2rc1 2010-07-24
1.11rc2 2016-01-16
1.11rc1 2015-12-26
1.10rc2 2015-06-27
1.0rc1 2009-08-16
0.99 2008-11-18
0.37 2008-08-17
0.36 2008-01-13
0.35.1 2007-07-27
0.35 2007-07-23
0.34 2007-04-13