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.4-cp39-cp39-manylinux2010_x86_64.whl (91.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

flow_network-0.1.4-cp39-cp39-manylinux1_x86_64.whl (91.6 kB view details)

Uploaded CPython 3.9

flow_network-0.1.4-cp39-cp39-macosx_10_14_x86_64.whl (19.2 kB view details)

Uploaded CPython 3.9 macOS 10.14+ x86-64

flow_network-0.1.4-cp38-cp38-manylinux2010_x86_64.whl (91.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

flow_network-0.1.4-cp38-cp38-manylinux1_x86_64.whl (91.6 kB view details)

Uploaded CPython 3.8

flow_network-0.1.4-cp37-cp37m-manylinux2010_x86_64.whl (91.6 kB view details)

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

flow_network-0.1.4-cp37-cp37m-manylinux1_x86_64.whl (91.6 kB view details)

Uploaded CPython 3.7m

flow_network-0.1.4-cp36-cp36m-manylinux2010_x86_64.whl (91.6 kB view details)

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

flow_network-0.1.4-cp36-cp36m-manylinux1_x86_64.whl (91.6 kB view details)

Uploaded CPython 3.6m

File details

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

File metadata

  • Download URL: flow_network-0.1.4-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 91.6 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.4-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 65d659df24b288cd94a83e6ca3d5d203cc38743d58b279850f4959e915990d51
MD5 7a4afaee3157666ab63ae903e2c32040
BLAKE2b-256 f8730ed70547d4fa4bfdfdf28f7c9576f946d0e6e6146c1054dfdf56d8440ddf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.4-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 91.6 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.4-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e5755c63630b65e5b3fc7d99a59ee2391b3a73ff60436dc1b7ae82cafb61cfb8
MD5 6a4c666c9b9123d8966b2211fd164f04
BLAKE2b-256 ebd72234bd9c240b705e946dfe477964c49adcfad24a8747214b01bcab6abc0f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.4-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 19.2 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.4-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 de0ba1c65661ee2233237dca29fe22c59a7338945911b051aaa105904b4a6b46
MD5 b685449c6c6d2e287520c02ee019222b
BLAKE2b-256 72f6aca3ddaf7b13e1212041770ed5e7ba6717e680a6dc5d4527e86eb088e87a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.4-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 91.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.4-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 27b042f94cdfde2f62d09afd52a266d38247b37020d73e4ded57eb5b1b1ad548
MD5 5bdb77d013ac0b8f4f4bdd5c84ad0b3c
BLAKE2b-256 5b1ab15713093ca3dfdc1bef38809d4ed335e72e21573d7bb62d0b696a99de99

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.4-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 91.6 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.4-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5e9035c6be625a7e7dce3f870231b2f40671d167701810a0512a6bb0c48a98af
MD5 7b8898988b5a1a6d4316b6999295721e
BLAKE2b-256 45d105b4727a2efbff25db42b1ff26a857b4eb8f0659c41896775e333f68cf5e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.4-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 91.6 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.4-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3dd4021319cb15d593052c1239a8fdfcba285ae03e7e9972e926d1abfefafa36
MD5 0d7f59d248846496c707d15439c6636e
BLAKE2b-256 775b65650571344eb618a45de4e8ad2de71c91655d294075dd024853d6e6d1eb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.4-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 91.6 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.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1db0485f796abcd746ab6253239a5d83a7eebb8d9f05343daac59c9bcb633698
MD5 92ae6716046d3072dc281b053a3f5c10
BLAKE2b-256 16e7fde23d77895b117453d8e7ef057301e752959441c5612c92236ac2486e19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.4-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 91.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.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.4-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3de3924ae741f3d7785988ba25192488c53ed39fa37b380cff977e2eca42f43c
MD5 110f5cfa76faea71ff5a1d171d0a1ed5
BLAKE2b-256 3aea1ebe948b1b15d24211f40cf7aae0ebfad919ed870cc7fe408187eb1f1684

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.4-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 91.6 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.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b4b138a2525e3ac9636444c776d648503400657a33e656766b0b3b00b0f477b9
MD5 915a54ae1de100044219e61eb937840e
BLAKE2b-256 7d3375659bb413c2309b2da8efca6b7d59b3d1dfadd32000693ba32ce5acf4d2

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