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

Uploaded Source

Built Distributions

flow_network-0.1.8-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.8-cp39-cp39-manylinux1_x86_64.whl (636.2 kB view details)

Uploaded CPython 3.9

flow_network-0.1.8-cp38-cp38-manylinux2010_x86_64.whl (630.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.8

flow_network-0.1.8-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.8-cp37-cp37m-win_amd64.whl (99.5 kB view details)

Uploaded CPython 3.7m Windows x86-64

flow_network-0.1.8-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.8-cp37-cp37m-manylinux1_x86_64.whl (631.4 kB view details)

Uploaded CPython 3.7m

flow_network-0.1.8-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.8-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.8.tar.gz.

File metadata

  • Download URL: flow-network-0.1.8.tar.gz
  • Upload date:
  • Size: 63.9 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.8.tar.gz
Algorithm Hash digest
SHA256 821296e9c787c7d103d0c558e1dd14a0c55218fc0818e30dcdd9e79473475790
MD5 93667c4c7017c2683b16153591e367d0
BLAKE2b-256 8cedd56d1f9f27de9eb1490a884989a1409a0c55032ebe413b3a422cdecd99ec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.8-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.8-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e75b085ae9391f04fed7da1bd1281b6031b987d8afac80c960255a9cd02b3b74
MD5 071753f2e79c4e913294d864f6529d84
BLAKE2b-256 4a02d196c25a9672f7d897834d081ceb02e5b414586fc28da25786bced67224f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.8-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.8-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2569aacb5510266434c1592c7d3e22cf27e0abfd42bb2657fb41b40b65454bdd
MD5 9092a00ccdb2f63a7a1a69507cce16c8
BLAKE2b-256 d37fd1ffc7b3ed6c3255b52ba23cce17ad729f0fa4e1619fad827b58bfb9cf05

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.8-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 630.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.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.8-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2647d24e524ab3e513df5ba3f4fb2d2ae207039aa15deadab56189c75ccca091
MD5 3bf28f30a6cc1a623e47cf65ba438013
BLAKE2b-256 455ab39f7e80f26395144435108c6db8d040c29cc81bf0ac9028e6b51ac087c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.8-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.8-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 271ccec399c77dd3beeee53eb33b2da6a7b784d39d5b9ec522acc5e35ad54fa6
MD5 61a21609ad2683e430b76d83a229bd3b
BLAKE2b-256 b3cc1d4d230dd3b03c042ed658aee2e6cd89058853a190e31931c55dd3bac5d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.8-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.8-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 af9b06f4322855ece6cfbdd565a57200f069e763fa828b5c60b304ed859ab0fa
MD5 ec6202c277bc8b74132d2e6bc306060c
BLAKE2b-256 ceb9d84dd23caa5e43d6b889f55b0a2e0b3d3946c729df76149cafee4ae6d1fe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.8-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.8-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 690edbd51cafac2c2c5c16813510b72dad0af6bfeb8d8304de750425c29af027
MD5 2c22636b907696af4ff02668dedcf330
BLAKE2b-256 5ec07b869eeaba50718fbd7c2a41d7a89798823f7778e76c1e61d619945c76ec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.8-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.8-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 1fa15ac048f7dce3ea43d6367eca5e7846f85b29b9b59a7118676679bc92b4ce
MD5 90815de5f9ceb0be2d378156a2793765
BLAKE2b-256 b8f21f8d92de8a303973d56dab9d75b2ee5b98abc5b7dc940630a3118b026af4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.8-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 631.4 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.8-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 601189bee5b5e9fd6779f9350603b1d44d2ef80f704626e2552c335c3d880f2f
MD5 e006a142713f90a28c7e4d0704315071
BLAKE2b-256 1dcd816406576c516419cf55e64c1884dd17eac10c927c72676794a8db9a7f43

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.8-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.8-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7ee0f21d432f935fed5d98ae5b5f56f73f3f246877a2b04bef01b8a1e2ee67ab
MD5 abc45c61d4a4e60f3edc0f4ca935ec74
BLAKE2b-256 4fb5e45cfde5656843e50b530ccddff0153948272653c15c30584d3ce4eb07c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.8-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.8-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b0c26797a50ad0f10b2993e1a80ef86a50c3b03b69783448feb4b593e985348b
MD5 88adb6706025d7b41a3b62ee184a3152
BLAKE2b-256 baa2750beabe00668923c5b12b277e109fa80adfb40f9c3e57beb4daa085c738

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