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

Uploaded Source

Built Distributions

flow_network-0.1.6-cp39-cp39-manylinux2010_x86_64.whl (629.2 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

flow_network-0.1.6-cp39-cp39-manylinux1_x86_64.whl (629.2 kB view details)

Uploaded CPython 3.9

flow_network-0.1.6-cp38-cp38-manylinux2010_x86_64.whl (622.3 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

flow_network-0.1.6-cp38-cp38-manylinux1_x86_64.whl (622.3 kB view details)

Uploaded CPython 3.8

flow_network-0.1.6-cp38-cp38-macosx_10_9_x86_64.whl (92.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

flow_network-0.1.6-cp37-cp37m-win_amd64.whl (97.0 kB view details)

Uploaded CPython 3.7m Windows x86-64

flow_network-0.1.6-cp37-cp37m-manylinux2010_x86_64.whl (621.5 kB view details)

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

flow_network-0.1.6-cp37-cp37m-manylinux1_x86_64.whl (621.5 kB view details)

Uploaded CPython 3.7m

flow_network-0.1.6-cp36-cp36m-manylinux2010_x86_64.whl (619.9 kB view details)

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

flow_network-0.1.6-cp36-cp36m-manylinux1_x86_64.whl (619.9 kB view details)

Uploaded CPython 3.6m

File details

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

File metadata

  • Download URL: flow-network-0.1.6.tar.gz
  • Upload date:
  • Size: 62.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.6.tar.gz
Algorithm Hash digest
SHA256 a606d5ed5cee4534787fdd1319df3cd29871cec1a02c473b46a8a34ed2f938ef
MD5 ad028d6c5c6ded634804157128119c14
BLAKE2b-256 5e3d920ffd7d0b326eb5a8312eb4d5e076e99ccd2dfd201de30bbd447477ca95

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.6-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 629.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.6-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c04f973a2d3771f2f336aab5a35cbfb6fd89d58c19f003e8db1eea3bc663bad4
MD5 6b76f38acf0ab9e9d6228d2fba401c4a
BLAKE2b-256 f093440097e1150421a3942f67e12ccc9e28178a0d3a8a8ee65896096582c79c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.6-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 629.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.6-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f7878f9a0901eb469b8d2300473a0395d75febb0ca18190459c67e74b63fc765
MD5 b63d00b236d92f72d157ea745a206e7f
BLAKE2b-256 fbd93a76b4e24a1210d3374a1103e9bbe9a12846d3fdbad70537671a2a6e45a9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.6-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 622.3 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.6-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a3ff51a90ea0d72caa2014d892cb319460222727f589cb97391c1e534584091d
MD5 fae7da627bf4ac819c1e12c47039f988
BLAKE2b-256 52ba8cdd18df9f76ee0ba623ec6c8c5bf5fbc935f9bb9370e62fe67daf77e893

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.6-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 622.3 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.6-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f38fd498072b37a2c05e17703de9f903d64f5b48c501729c1ac84e7d1f1f4b16
MD5 24744105e5cfdefac219cccf8981c429
BLAKE2b-256 f678938eb6f98fc7310a889d83876494cde25a60d48fff022e21bb804775c9bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.6-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 92.6 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.6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 00a5fc1d1099f614e577486a58ce532fa043b2ecae0aa051955723fddca3ab65
MD5 8089099afbd3a38d3e2d321d06dfa5a4
BLAKE2b-256 1a414a263c45ec15d57550563edec34955bd27593f4179749831f99902f46f64

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.6-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 97.0 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.6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 b361f686117886dfb91d09a4f505453c87d2772c212e402b6ebff3942719df31
MD5 276390059fe2fd606909decf0ff33465
BLAKE2b-256 411c703b3c871f421d26cf044c37196d22720ee7028d055de2894c363e5d3fa4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.6-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 621.5 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.6-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e8c2350eced7379ec5b6c22361ff86a87136876c77f4f10c735c1a352b0ad1bd
MD5 a88d43978f060a8865c1f23ac5226bd2
BLAKE2b-256 f1d8c33a2cf6400aa32ab3bbdb8e46203f55d6f09fe256dc87d668ad5a675c0c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.6-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 621.5 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.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 137055abff41d3866a79253a7ab62cd131c0b9d6c63a21feec3867f8018954b6
MD5 b5587c1effe5135b19d4aacc62334f46
BLAKE2b-256 fdf6543ac933e93e4dd60d3582f9cc97fada2f06b82b951f6ff7c987b0c87995

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.6-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 619.9 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.6-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a555e38a0a6796a57d9db1893e620d629bcef3f21eb2d1c3542dac2cd5b39e66
MD5 44fe7cd8fd59492217268136bbb6699e
BLAKE2b-256 cf5f792f991a5a8405ebb0c1110bf506735e7777a8c521953be0628eecaa703d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.6-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 619.9 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.6-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 95427a26850f5ce39a3a2731c11fd8944479ad0d82b2ff5ea8a33a23398aa1aa
MD5 993d60dcdeeea54dcd990768bffa66c9
BLAKE2b-256 8456f2b4ca1c7929257a4c3795a9f43916df1ddffd1fa91ed73558162e8842b2

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