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

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

flow_network-0.1.2-cp39-cp39-manylinux1_x86_64.whl (90.7 kB view details)

Uploaded CPython 3.9

flow_network-0.1.2-cp38-cp38-manylinux2010_x86_64.whl (90.7 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

flow_network-0.1.2-cp38-cp38-manylinux1_x86_64.whl (90.7 kB view details)

Uploaded CPython 3.8

flow_network-0.1.2-cp38-cp38-macosx_10_14_x86_64.whl (18.4 kB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

flow_network-0.1.2-cp37-cp37m-manylinux2010_x86_64.whl (90.7 kB view details)

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

flow_network-0.1.2-cp37-cp37m-manylinux1_x86_64.whl (90.7 kB view details)

Uploaded CPython 3.7m

flow_network-0.1.2-cp36-cp36m-manylinux2010_x86_64.whl (90.7 kB view details)

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

flow_network-0.1.2-cp36-cp36m-manylinux1_x86_64.whl (90.7 kB view details)

Uploaded CPython 3.6m

File details

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

File metadata

  • Download URL: flow_network-0.1.2-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 90.7 kB
  • Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.2-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6a230908e0f9a7bf6cf6009d4eaa6c8eed593335de26fcddc3b3902077fbd0f4
MD5 d35c38294f8736d784186cbd9b172ac3
BLAKE2b-256 8c32cba5ba05daaf2aeb36be5f350bcccda4445c5884a9fb4d96d1ecce353436

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for flow_network-0.1.2-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 32b5d6c0cfd28af7bea480bc5912f8577dd754a4356f7b6a081918eedd06ebe7
MD5 0baa3ee64894685a11a8759ed00f8cf8
BLAKE2b-256 f02b448bbf6f7ae37bdc107c27f314b5e826c987a6c8c1374f3ddde4735a2c9c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.2-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 90.7 kB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a7d8cf2d0a0e3d6d4cce885ff20fcb61bbba04d5dd35b84c0bdb827cfe02efed
MD5 b7471dd6a7bb92d7a81e41d556237621
BLAKE2b-256 c1a68ceb9eff88d48026d35035fbd4275d21bd8d2454241f60eb6517e1ecb940

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for flow_network-0.1.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f7671b92026f9fbb11a345f7c50193458f78a5085b8874f4ee156dfd82f1c156
MD5 867eb195fb87eac7b8f45e689502c6c6
BLAKE2b-256 10f31badbdacf6af0435bfb7e8d65e1acdf6ddf6b26958b3abb042f073f6cd07

See more details on using hashes here.

File details

Details for the file flow_network-0.1.2-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: flow_network-0.1.2-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for flow_network-0.1.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 2ff4744c997489cd37b5442c1a4eb3387d21416260e598d1673c53ef507798a1
MD5 b37bb2a615a3a721f21c2fb5728d9bee
BLAKE2b-256 4b124cd1bec81c1f63fc7b1443f884fd68362d797dcdbfabb786700520f274a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.2-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 90.7 kB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a5ca61f7b7ee9de54f5c650bc698a4c5788b099d56b3597cb96894b07ec9945a
MD5 abab49a16b1e59c2e66b15245f11ea2f
BLAKE2b-256 d57f36c6a6c9eab2897a53bb8c1ea78efbc63e6b3cbed5b54acbb8d1b0f7ce1f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for flow_network-0.1.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1da9f95874dab4eb7417c609f3ead0aa8c9be56ebedac6c69694e441f6cfc9e0
MD5 5d160585a6328d86612e33deb3530ab0
BLAKE2b-256 d09bddde03f1353b1e8faa11f98636ec46148c79194ad13925e73193c8068c71

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flow_network-0.1.2-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 90.7 kB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for flow_network-0.1.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b068cfac4890630aa0de2496011e18ffe66d7505948b41f4d8f73c0438ec2f3c
MD5 31853834957dc30858363c6618bd46cc
BLAKE2b-256 ad668ffe26e7145be395dcb4b4cfe63227a7df7a8498410c2eafd9e93c741a15

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for flow_network-0.1.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 65b12e699c6cebeec8d1e922837b9dc0844ab9e5876bb033f4ce94069447870f
MD5 e6b02d896d28262f3c7236d4e6eb263c
BLAKE2b-256 5a6e0990767ff88305320d3073934864b22695083b61899d5beaf9f5cef594b2

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