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.9.tar.gz (64.6 kB view details)

Uploaded Source

Built Distributions

flow_network-0.1.9-cp39-cp39-manylinux2010_x86_64.whl (646.9 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

flow_network-0.1.9-cp39-cp39-manylinux1_x86_64.whl (646.9 kB view details)

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

flow_network-0.1.9-cp38-cp38-manylinux2010_x86_64.whl (637.0 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

flow_network-0.1.9-cp38-cp38-manylinux1_x86_64.whl (637.0 kB view details)

Uploaded CPython 3.8

flow_network-0.1.9-cp38-cp38-macosx_10_9_x86_64.whl (97.5 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

flow_network-0.1.9-cp37-cp37m-manylinux2010_x86_64.whl (638.3 kB view details)

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

flow_network-0.1.9-cp37-cp37m-manylinux1_x86_64.whl (638.3 kB view details)

Uploaded CPython 3.7m

flow_network-0.1.9-cp36-cp36m-manylinux2010_x86_64.whl (637.0 kB view details)

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

flow_network-0.1.9-cp36-cp36m-manylinux1_x86_64.whl (637.0 kB view details)

Uploaded CPython 3.6m

File details

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

File metadata

  • Download URL: flow-network-0.1.9.tar.gz
  • Upload date:
  • Size: 64.6 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.9.tar.gz
Algorithm Hash digest
SHA256 a35c056b24e3e0e7afbffcf47cafed313d9b51158015427076b7a3c0282f5413
MD5 0a66e780f7dc14b52f3deda046fd1dcb
BLAKE2b-256 04cbcd9299b055f0ed36a97bcfee61b3b315f4db454b0c066612314d4cd57505

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.9-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 646.9 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.9-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 41be8c4df9077ff1d9bc2fdb90e9e3acea86dc01077eddfea63a822b7653d00d
MD5 cffd89504ff650767770ec240403d248
BLAKE2b-256 d8e46c6585585b8344d963828193deee820cc78b05ed52d422a9f465af39addf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.9-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 646.9 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.9-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5821f5d6408f1a51b99c13504ffe890e3052e47a238672df2ecf652bf1ea2f43
MD5 93db6f8d854113bb8449496886bad208
BLAKE2b-256 0681f3fb70874a236f51b4f97d0cae57e7c6d8df42385861b907adab12e8cfd4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.9-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.9-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 bdfd02f10b485fa0fc2485fee7a00b39dc3b38a2edc70412cb82a096a709b035
MD5 79a7edd877dbac69dac473251a3b1c42
BLAKE2b-256 2235d578ec41074eb46070055d31f233af9bdc6ab38b6b2e65e3c378870f50cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.9-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 637.0 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.9-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 18486c6a467bd63e219383e7f44c1b151506e16c546700e8ba1805ad8200e848
MD5 396ebf0ae3bef259c1a2a6d36e031a23
BLAKE2b-256 59a541b5eec50ff6a8c3477d5669387ca55b2632078ef3a87b8c9dde3b6dafdb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.9-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 637.0 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.9-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0c8d8133f4ca04d1a1397dcb5fa5a367375d2a6fd8147ae0b21644d2c6aec439
MD5 121f27209ce9faac2f7f038528b3b935
BLAKE2b-256 4e32d2835d7a6edf147c6f89d4000f4133130467a0644946d547806cfdef7f42

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.9-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 97.5 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.9-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2a0c74fbf3b2d595cf7daead36dd00ff7fea13e6bf147d1774daf8be098e3a9b
MD5 7fd5d1db30542ac77b8cd8265f147d66
BLAKE2b-256 de774e953277c2d137f3bbcdb323d82519429e50766cfd2a6b58e20d32e8f66e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.9-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 638.3 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.9-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 25ba1b3bd2ef8926f2b38a7f9969a5ccf4b0955378939a2a7bc6d2256fbdd8ce
MD5 3703d9186d260c9a34601b4c343c50c3
BLAKE2b-256 0c8904f7a85f56aa730bd8c552cd1fea5868e093442d426c896137f3038f5d64

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.9-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 638.3 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.9-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bcaa09f795392e7ec77f542117146a8e105915ef128379b0754b6a7499c8bc22
MD5 0741cfc43237273c28a06473c7cb0ccb
BLAKE2b-256 d94bd75bb8786d31a86589190ccef213a790c7badb6bfbffb25619c08f448529

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.9-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 637.0 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.9-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 21554d827164c2949b82a2b0bb20e24c442a9adb046f7f75332b159ce82f0377
MD5 0a50a8597dc851f7af04a3ae58adf523
BLAKE2b-256 5195173fa102804f55bb37e9acf4a9fb75490e4e510d431ea40f4c543daa6b39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.9-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 637.0 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.9-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8f0fcef98ee698f47f9b64148c8139c5b3ebab16186928a72451ade9dcf177c0
MD5 fc5fc869c43ef64e93e90c7f6f86e910
BLAKE2b-256 e9ceedfee14ede2414f74a0613199b11573d99c17240ee16a47a1b0ab5ea68ac

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