Skip to main content

Flow Network Python Library

Project description

Flow Network

网络流的工业级应用

Release Drafter Upload Python Package

使用 Dinic 和朴素费用流,算法来自 DuckKnowNothing - 网络流

支持平台

在尝试了各种方法之后,GitHub Actions 在 Windows 平台下始终无法正确编译 C++,所以放弃支持 Windows 平台

  • Linux
  • macOS

安装

pip install flow-network

样例代码

from flow_network import MaximumFlow, MinimumCostFlow

mf = MaximumFlow(2)  # 创建一个包含 2 个点的网络流对象,下标从 0 开始
mf.add_edge(0, 1, 3)  # 添加一条从 0 指向 1 的边,流量为 3
result = mf.run(0, 1)  # 指定源点为 0,汇点为 1,跑最大流 & 最小割
print(result)  # 3

mcf = MinimumCostFlow(2)  # 创建一个包含 2 个点的费用流对象,下标从 1 开始
mcf.add_edge(0, 1, 3, 2)  # 添加一条从 0 指向 1 的边,流量为 3,单位流量的费用为 2
flow, cost = mcf.run(0, 1)  # 指定源点为 0,汇点为 1,跑最大流 & 最小费
print(flow, cost)  # 3 6

测试代码

tests.py

Reference

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flow-network-0.1.10.tar.gz (64.7 kB view details)

Uploaded Source

Built Distributions

flow_network-0.1.10-cp39-cp39-manylinux2010_x86_64.whl (647.0 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

flow_network-0.1.10-cp39-cp39-manylinux1_x86_64.whl (647.0 kB view details)

Uploaded CPython 3.9

flow_network-0.1.10-cp38-cp38-win_amd64.whl (101.0 kB view details)

Uploaded CPython 3.8 Windows x86-64

flow_network-0.1.10-cp38-cp38-manylinux2010_x86_64.whl (637.1 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

flow_network-0.1.10-cp38-cp38-manylinux1_x86_64.whl (637.1 kB view details)

Uploaded CPython 3.8

flow_network-0.1.10-cp38-cp38-macosx_10_9_x86_64.whl (97.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

flow_network-0.1.10-cp37-cp37m-manylinux2010_x86_64.whl (638.4 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

flow_network-0.1.10-cp37-cp37m-manylinux1_x86_64.whl (638.4 kB view details)

Uploaded CPython 3.7m

flow_network-0.1.10-cp36-cp36m-manylinux2010_x86_64.whl (637.1 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

flow_network-0.1.10-cp36-cp36m-manylinux1_x86_64.whl (637.1 kB view details)

Uploaded CPython 3.6m

File details

Details for the file flow-network-0.1.10.tar.gz.

File metadata

  • Download URL: flow-network-0.1.10.tar.gz
  • Upload date:
  • Size: 64.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for flow-network-0.1.10.tar.gz
Algorithm Hash digest
SHA256 67e63107900f75f68825548c32d9912d318f1eb32e7610edc1e4ef9a5287514a
MD5 ee68cfeaeaf95d190eb8328546505fbe
BLAKE2b-256 ac3205bfb46e122486f5a3c254b94960758e56b8d023a522fc0b366bd8cabd8b

See more details on using hashes here.

File details

Details for the file flow_network-0.1.10-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

  • Download URL: flow_network-0.1.10-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 647.0 kB
  • Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.10-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8bb863a61bf1c615457c3d8b2e96a827fd49975f7775f99a0dfdbf0cee80a7a6
MD5 963d36c7fcc3f4a1dd599888f224a973
BLAKE2b-256 8ea6513db9c95faa614a750d9d1f783ad3d777a2fc0d7e17779e4f7472bf48de

See more details on using hashes here.

File details

Details for the file flow_network-0.1.10-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: flow_network-0.1.10-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 647.0 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.10-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 07f045dbeae1c3a90ca33d90387cc881a0c14c19a7492630ce0fcb88a14d93ed
MD5 ae6b551b985ef52022093c9c0c4364da
BLAKE2b-256 5669e53ab37f890b53abee4fd2d635e1b28432f38b4e27d22b64bc7bfc327a94

See more details on using hashes here.

File details

Details for the file flow_network-0.1.10-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: flow_network-0.1.10-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 101.0 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for flow_network-0.1.10-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4df63f3d853914d8e2aea34a066b7586fe5f9e4514eacc6bdc85e4c9195a1828
MD5 ee7a646002f1fd5952f0acb77831ae3c
BLAKE2b-256 35aad2d86c8db79684ecdc07c1fd0460544a52461d01540b919e85cd5fae431c

See more details on using hashes here.

File details

Details for the file flow_network-0.1.10-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: flow_network-0.1.10-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 637.1 kB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.10-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 baf32f1091a65f7aa9f93683b86c5da60bb93ce322bdc2e73995b0b241d5f136
MD5 4636b00417027c87136137310c67bbb6
BLAKE2b-256 1fb240a89ff6f4248ace73dd18d63db392c65ce42513cc6385fed8db7b1a7d2c

See more details on using hashes here.

File details

Details for the file flow_network-0.1.10-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: flow_network-0.1.10-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 637.1 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.10-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ed474df4fd9eb6f83842419701220c4fa68885c6dd670539a3635a0186899f44
MD5 ef38faec3b360019eebc0411e93c7202
BLAKE2b-256 76e5f9bb0f0cf14b86a69a814c9d1640c68b7a6a43f0cc3a25853b7d055528f0

See more details on using hashes here.

File details

Details for the file flow_network-0.1.10-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: flow_network-0.1.10-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 97.6 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for flow_network-0.1.10-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b628a54d13d3db729d3ef16f701d97f3a7ce143c0d57fd4ab3b314b88c334bc1
MD5 9aba40568200a75450544be8a22de8f5
BLAKE2b-256 a39c82302258ea51a8e0da53d4d80a3de8f3a64865b119af68970a85b39bafaf

See more details on using hashes here.

File details

Details for the file flow_network-0.1.10-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: flow_network-0.1.10-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 638.4 kB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.10-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 bc08093560567136da9a78e29f713c4a243bf242454c037c00abadaea7eac449
MD5 2e99cfd43b0462bc1971e74de51ad781
BLAKE2b-256 9a92a71b7d7532eb00f47ebbe2214e0fc10b5e8c1ba7300105c4a6bca1541341

See more details on using hashes here.

File details

Details for the file flow_network-0.1.10-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: flow_network-0.1.10-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 638.4 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.10-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8506ae38ab1358656c49f4401ea7707eb181e948d2751b731e29e513eeb0f134
MD5 d3a9acb7249d05a9d144c318d1625fa6
BLAKE2b-256 d9ec0bd3c2a103a3974b36b577cc62ac200804410ec0f5f8fca058a033b76c98

See more details on using hashes here.

File details

Details for the file flow_network-0.1.10-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: flow_network-0.1.10-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 637.1 kB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.10-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a13fe032e8e822bc0bcf3015bea3152bf55bd0a069783cc66ed784497748af8a
MD5 fc2b3df943862babf3aca91ccc6bcaea
BLAKE2b-256 3ffa4684b6298c904cd9ed19f2e84a778364c2f688416657137771431d76e370

See more details on using hashes here.

File details

Details for the file flow_network-0.1.10-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: flow_network-0.1.10-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 637.1 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.10-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 defc18b63146e3c7aa9cd6afff366240334bda1a284a572fc637ef272c2d88e6
MD5 2fc28dcaa33302570ac566600f15689d
BLAKE2b-256 43e8a5491e4b0f4851f83d13027107c1fe63ad624d65e44f96efc0e01635ee83

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page