Skip to main content

Flow Network C++ Implementation

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 FlowNetwork, MinimumCostFlow

fn = FlowNetwork(2)  # 创建一个包含 2 个点的网络流对象,下标从 0 开始
fn.add_edge(0, 1, 3)  # 添加一条从 0 指向 1 的边,流量为 3
result = fn.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.7.tar.gz (63.8 kB view details)

Uploaded Source

Built Distributions

flow_network-0.1.7-cp39-cp39-manylinux2010_x86_64.whl (636.2 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

flow_network-0.1.7-cp39-cp39-manylinux1_x86_64.whl (636.2 kB view details)

Uploaded CPython 3.9

flow_network-0.1.7-cp38-cp38-manylinux2010_x86_64.whl (630.5 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

flow_network-0.1.7-cp38-cp38-manylinux1_x86_64.whl (630.5 kB view details)

Uploaded CPython 3.8

flow_network-0.1.7-cp38-cp38-macosx_10_9_x86_64.whl (95.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

flow_network-0.1.7-cp37-cp37m-win_amd64.whl (99.5 kB view details)

Uploaded CPython 3.7m Windows x86-64

flow_network-0.1.7-cp37-cp37m-manylinux2010_x86_64.whl (631.4 kB view details)

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

flow_network-0.1.7-cp37-cp37m-manylinux1_x86_64.whl (631.3 kB view details)

Uploaded CPython 3.7m

flow_network-0.1.7-cp36-cp36m-manylinux2010_x86_64.whl (630.3 kB view details)

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

flow_network-0.1.7-cp36-cp36m-manylinux1_x86_64.whl (630.3 kB view details)

Uploaded CPython 3.6m

File details

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

File metadata

  • Download URL: flow-network-0.1.7.tar.gz
  • Upload date:
  • Size: 63.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 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.7.tar.gz
Algorithm Hash digest
SHA256 a682cb7de717c6e8f78df9e3374417d4f14f73531d02354076757625dabbec15
MD5 cac939b9288c28ca5b59b7ed4c44dcf8
BLAKE2b-256 d3067b49a65ebe8a47f60a9dd4e0e21d75a9bd062541e8c7a7d4dc444baaf820

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.7-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 636.2 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.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.7-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 be321d17f71e0c363a6ae04e79854c3c90206b536258adc8a54fc1ff6b1b5606
MD5 6e8144d76d8186bc28729503628719c2
BLAKE2b-256 314ba4c03b006e8e48709c6fe0620a0148f266cb40f3f0abb1281fad0b152d4a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for flow_network-0.1.7-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d19c8d2a16c775897a9f384898fa6d519d161155f35c7f1d1a09a44fa36bc723
MD5 e16123cbe9cf6101c541c47d4eecdf58
BLAKE2b-256 1d2bcb37b99663b0edae3ccaba3806c643ee8647bd674394e45694973a750bb6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.7-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 630.5 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.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.7-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 476236db2cfb796da51f5f59cb909289476f58f95c604bd6e69dfcabbf17e486
MD5 09af0110f6d1f7a1360a88ed712c1d38
BLAKE2b-256 2a9f25b7ca41bb516f58191c2d16115ffab2a23ad4c1df6a231fcdea512156eb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for flow_network-0.1.7-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ecd88a8692d6abedca22deafb1ce2d8979d2f09e896f3afbc67f7fbc2e944c96
MD5 1fea769bec3ca7b5581c215b7361f36b
BLAKE2b-256 ab5668abcf6ca58fd27ba53d9995cf859e3b0877a83713ce9c8e0867233e46c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.7-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 95.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.0 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.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8c444be2a96829b94743fe9d47b01a4e3691a02899024ed324bbd4f802bb2397
MD5 579d1fbd56cde9eec65702cdec3940be
BLAKE2b-256 a453b6104e21aa7b111b170d9b2df74e238eee8e55963a22cd08cd077a7a2e56

See more details on using hashes here.

File details

Details for the file flow_network-0.1.7-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: flow_network-0.1.7-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 99.5 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.3

File hashes

Hashes for flow_network-0.1.7-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 017273344c87cf780567674d884bd320f3bb6e53f35288b7c33e11eb92c3c36a
MD5 3e08592734eb76cd814958466b9fad3d
BLAKE2b-256 2cc1ffaa81b3bd68b9b7b302dfbecb1d46cb5802be1a8eca7ec0d7ac148a8433

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.7-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 631.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.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.7-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b5e4dc144148ec2b795c817fa615b4bd886a1de008208cf78fc04bc8a4038bbe
MD5 c13ea527222c0ecd435b2935de2578c2
BLAKE2b-256 4b16be69bb979cf131b1778f2ac05b4eb367be2d6a349dfd2830208bd0d32af5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for flow_network-0.1.7-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bae3fb29e2a78ddcbd4ee972251dfa8616609ce84ad25f585790f6185d65acd6
MD5 a91c15b11217bd980b06b9f9a18e3dcd
BLAKE2b-256 c300b5dc15be0cddb0ea730e0557eef217e790bf75167ac8a33f66cad8a2e8a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.7-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 630.3 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.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.7-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a87ce36cee2b359810a1b83f7ef6f16111ab0e2927f5be4f943cbea09edbb8c4
MD5 f7c5165012a7c245ec9ea9415c3b81d0
BLAKE2b-256 d1800340ff512a52472bf03fa90e007db175f25b8a491599608bd5b720b1c3ec

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for flow_network-0.1.7-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 258dda089f4f454528db5a704d9f2bdd90d96c7f47e045cfd8ae9619acf3736b
MD5 1dcb0b06549ed8e9f93ac4a9922d3ec1
BLAKE2b-256 19d60a4c2f627dcebb648b8d106a5fedf1f436fb2f200664bc9a91c3412ca98f

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