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 个点的费用流对象,下标从 0 开始
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.12.tar.gz (64.3 kB view details)

Uploaded Source

Built Distributions

flow_network-0.1.12-cp39-cp39-manylinux2010_x86_64.whl (645.5 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

flow_network-0.1.12-cp39-cp39-manylinux1_x86_64.whl (645.5 kB view details)

Uploaded CPython 3.9

flow_network-0.1.12-cp38-cp38-win_amd64.whl (99.1 kB view details)

Uploaded CPython 3.8 Windows x86-64

flow_network-0.1.12-cp38-cp38-manylinux2010_x86_64.whl (635.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

flow_network-0.1.12-cp38-cp38-manylinux1_x86_64.whl (635.6 kB view details)

Uploaded CPython 3.8

flow_network-0.1.12-cp38-cp38-macosx_10_9_x86_64.whl (96.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

flow_network-0.1.12-cp37-cp37m-manylinux2010_x86_64.whl (636.9 kB view details)

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

flow_network-0.1.12-cp37-cp37m-manylinux1_x86_64.whl (636.9 kB view details)

Uploaded CPython 3.7m

flow_network-0.1.12-cp36-cp36m-manylinux2010_x86_64.whl (635.6 kB view details)

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

flow_network-0.1.12-cp36-cp36m-manylinux1_x86_64.whl (635.6 kB view details)

Uploaded CPython 3.6m

File details

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

File metadata

  • Download URL: flow-network-0.1.12.tar.gz
  • Upload date:
  • Size: 64.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for flow-network-0.1.12.tar.gz
Algorithm Hash digest
SHA256 7d987b050fa9367cfbc007325a5a0ef1b82c49c5222914f42815a6270d4c2d30
MD5 d7af322d9eab77df53514bcaef2145c6
BLAKE2b-256 f8c6591a6f1abdc106b639909d7a8e82ebe449807fb09ee63cf9b84840c32e27

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.12-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 645.5 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.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.12-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f7ec64d1fdd5be7211839ba67857600d5b234942fc41609c5677b4cae983fde2
MD5 6821f646ee27575a4285992b7c89d788
BLAKE2b-256 01b204e2032eae54183a03cbb2e38b5a1938abc0a49c136ab6ac112e4efc572b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.12-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 645.5 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.12-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 95318098e99af6e8253b7f64706418d2965afff44cd3b6596ae01901ee9dd1ac
MD5 46f5282491ae1d8f4588c7acfbbfe231
BLAKE2b-256 9e45d7b1f30c42feba8a78cc40a374bbcd42f4dddd04d3c12cf33acca240dc03

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.12-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 99.1 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.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for flow_network-0.1.12-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d9a96456843c337ac60caf895df7a2ddbe44947d2d060ea7b418f48d46b1c806
MD5 5b80e307f15a5cb4baae61c4d8a1a2b9
BLAKE2b-256 28ea332a9cefbd63dfbff843867aea3b5500bfbed9e42082065a4d1cda254037

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.12-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 635.6 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.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.12-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7b0b37ac8fa2dfb6a08c774da253a2495e8fe93e2f1c45fa69bf797e07bb2865
MD5 575ba2b9e8e7ecffbe8ccca2249f2bf3
BLAKE2b-256 445a1a092cad77325482c174ba4ea26ce604f9f6cea31f0e66e8f891254a02bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.12-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 635.6 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.12-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8c6b7323d2d8d76a3c01f5f09bd5bbff5a430fbbb99601632a122aa059081100
MD5 03fce878cd18d2379aaef789ab885143
BLAKE2b-256 38bd2d21ed6e9a4baaa51e930a1530fbf9d82b59a262cb22b642c752590c5c2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.12-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 96.1 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.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for flow_network-0.1.12-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 35d4b3907c812be090a97115b7a50de18ed5e4461ee463b5a5a56cfabf1917a5
MD5 fdb1563fd8f8ba3853a14feb325b7233
BLAKE2b-256 f7c8f9528406e705a0fdc20f95337d9ad4d155c3bf84eb8943a685ddeb268097

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.12-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 636.9 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.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.12-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 5627562cb2320f32e9baf5ae30324338d01e9fc9754d72ee4b363e64d82565ca
MD5 ee137733c94325bdc19518b078854147
BLAKE2b-256 2de3da05d5e0e19dddb2c091a09deef589ba1406c91f9c352e65efbffe0991e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.12-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 636.9 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.12-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 32eef7a1d164417af10562920fa180709317255b1dc50f8fd0a09963f8a0e516
MD5 1d899936d3a08774795db0369bc89f3d
BLAKE2b-256 e7cf045acd9e40b9fadb076d5d7b8bb31fde7a5e70569a571e3eb51ee25dcda9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.12-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 635.6 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.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.12-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 9f2be2e9783196ab2dc4958f225ce23534e330673935f571474b689073be75b4
MD5 e812d3c576e5c1b2c3c6714899671a96
BLAKE2b-256 a19f25bc8a90d208730307d0453510760796d33f6096fe283a919d990924f016

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.12-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 635.6 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.12-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 de2b8efbb29aaee52049eb51db605b8561ab9c4b2cf14918587857ef604895b1
MD5 75b75df8ad7a8f24ba847892b1204810
BLAKE2b-256 2aabf22d0f332a91ddd1ee6cc0242b339b5ef244bf2e4566f7692473ac354448

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