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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

flow_network-0.1.5-cp39-cp39-manylinux2010_x86_64.whl (91.8 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

flow_network-0.1.5-cp39-cp39-manylinux1_x86_64.whl (91.8 kB view details)

Uploaded CPython 3.9

flow_network-0.1.5-cp39-cp39-macosx_10_14_x86_64.whl (19.4 kB view details)

Uploaded CPython 3.9 macOS 10.14+ x86-64

flow_network-0.1.5-cp38-cp38-manylinux2010_x86_64.whl (91.8 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

flow_network-0.1.5-cp38-cp38-manylinux1_x86_64.whl (91.8 kB view details)

Uploaded CPython 3.8

flow_network-0.1.5-cp37-cp37m-manylinux2010_x86_64.whl (91.8 kB view details)

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

flow_network-0.1.5-cp37-cp37m-manylinux1_x86_64.whl (91.8 kB view details)

Uploaded CPython 3.7m

flow_network-0.1.5-cp36-cp36m-manylinux2010_x86_64.whl (91.8 kB view details)

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

flow_network-0.1.5-cp36-cp36m-manylinux1_x86_64.whl (91.8 kB view details)

Uploaded CPython 3.6m

File details

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

File metadata

  • Download URL: flow_network-0.1.5-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 91.8 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.5-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f471576a69a0550e0c24a50b55a1ac4e693abbf49c792e8f1ff391b4f80303ce
MD5 c979e769f81e172089c35282eee1073c
BLAKE2b-256 fad146d806c25a7323f7d4fc98edab30b11c120379983e5bbfd4bdd8c3e77fe8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.5-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 91.8 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.5-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6e49e88aeec18abf68eb4cba6dd1413ff8277024fe6aca17f4ebf9c479d43e1e
MD5 d45d5ef90bdad07a9c7a6cffa7f0dd4e
BLAKE2b-256 70132b1840a11bc6d41eb22444fa7439b662559d65f4825bb85bd1a7bdc6abf9

See more details on using hashes here.

File details

Details for the file flow_network-0.1.5-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: flow_network-0.1.5-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for flow_network-0.1.5-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 d10cdddbffea317882ea3b7767bcaca794a4db4f79bf7f98998bd51b0738b9c0
MD5 6c480cd23d68ebef96eb72707c3000b7
BLAKE2b-256 e0577c2c0b3e9ba22da94cc6627b75028918edd16650bffac1d7be021dcc58af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.5-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 91.8 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.5-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 5336c08c541503b47b11e4ab31c81246e09c9607e5a41d0cd20454541b2832c8
MD5 697aeb124fe823690183a3e752f24602
BLAKE2b-256 827d450035e34af3d284a88ed66e42948d7ccf7e978dd5d2df2d8f69e9daed6e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.5-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 91.8 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.5-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dbb190cd154b6243c46d0ade877c5228fb1d72d3dacdb4ac741a3a009f18c0e1
MD5 8bc8613309e89e8f8957a855a50e69c3
BLAKE2b-256 7c6ffbad6315cf711b491b855ebc4f8db6ca6602764f046cf81b8fb635741949

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.5-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 91.8 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.5-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3038f21c471bdcdb42e9b2e1ee4d6a082b8100a5449e9b1a2691b52d8f586869
MD5 e6e5dc3a735f34c89b0fe9ff9d12c1b9
BLAKE2b-256 1544f4c91050ae2ff402880cf87637f156ce12ad487fd7ec6c4cdc3aa02bbdcd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.5-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 91.8 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.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a1dd088bb99b89f0784b254aa21a85d6038fe469562abcd4ea869887c4662ac7
MD5 91d83c5b52f41332b40d7efde8d31e62
BLAKE2b-256 82bd38537c604828eb6a9329b6d68aec7e76fe1c3e771d4fe59a95c2229bb17d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.5-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 91.8 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.5-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d4741ffec3d42d1aa6f3933a7e30ab9c62c27c8b07ec22a1669e5fc75d326a09
MD5 6e181222e2146c2c95541fb772022eca
BLAKE2b-256 d743e0138313706be1e06f3828de3ece46fcbdff61e933a83e0b6a4ff069ed54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.5-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 91.8 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.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9214da91de17a4c5cf70189fcbc628b19b07a8d69ced70ff91d13294649b2a83
MD5 2a03e0677c384c952e706d2819fb29fe
BLAKE2b-256 cc20158a79139b743ee101c3f6cf89fd700fa4ec42853739554cacab6cc4f5a7

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