{"id":19878994,"url":"https://github.com/lucienshui/flow-network","last_synced_at":"2026-02-18T11:02:12.648Z","repository":{"id":53579479,"uuid":"301428526","full_name":"LucienShui/flow-network","owner":"LucienShui","description":"网络流工业级应用","archived":false,"fork":false,"pushed_at":"2021-03-23T12:02:35.000Z","size":76,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-28T00:08:15.168Z","etag":null,"topics":["algorithm","flow-network"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/flow-network/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LucienShui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-05T14:04:25.000Z","updated_at":"2024-06-19T01:20:28.000Z","dependencies_parsed_at":"2022-09-02T11:51:33.720Z","dependency_job_id":null,"html_url":"https://github.com/LucienShui/flow-network","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/LucienShui/flow-network","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucienShui%2Fflow-network","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucienShui%2Fflow-network/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucienShui%2Fflow-network/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucienShui%2Fflow-network/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LucienShui","download_url":"https://codeload.github.com/LucienShui/flow-network/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucienShui%2Fflow-network/sbom","scorecard":{"id":86259,"data":{"date":"2025-08-11","repo":{"name":"github.com/LucienShui/flow-network","commit":"9f172932def39565ee078468988a78265e12565f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/15 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/python-publish.yml:1","Warn: no topLevel permission defined: .github/workflows/release-drafter.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/LucienShui/flow-network/python-publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/python-publish.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/LucienShui/flow-network/python-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/LucienShui/flow-network/python-publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/python-publish.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/LucienShui/flow-network/python-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:78: update your workflow using https://app.stepsecurity.io/secureworkflow/LucienShui/flow-network/python-publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/python-publish.yml:80: update your workflow using https://app.stepsecurity.io/secureworkflow/LucienShui/flow-network/python-publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/python-publish.yml:86: update your workflow using https://app.stepsecurity.io/secureworkflow/LucienShui/flow-network/python-publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-drafter.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/LucienShui/flow-network/release-drafter.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:28","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:29","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T06:59:38.820Z","repository_id":53579479,"created_at":"2025-08-15T06:59:38.820Z","updated_at":"2025-08-15T06:59:38.820Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29576861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T08:38:15.585Z","status":"ssl_error","status_checked_at":"2026-02-18T08:38:14.917Z","response_time":162,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","flow-network"],"created_at":"2024-11-12T17:07:19.088Z","updated_at":"2026-02-18T11:02:12.623Z","avatar_url":"https://github.com/LucienShui.png","language":"Python","readme":"# Flow Network\n\n网络流的工业级应用\n\n![Release Drafter](https://github.com/LucienShui/flow-network/workflows/Release%20Drafter/badge.svg)\n![Upload Python Package](https://github.com/LucienShui/flow-network/workflows/Upload%20Python%20Package/badge.svg)\n\n使用 `Dinic` 和朴素费用流，算法来自 [DuckKnowNothing - 网络流](https://github.com/UPCACM/DuckKnowNothing/tree/master/src/GraphAlgorithm/%E7%BD%91%E7%BB%9C%E6%B5%81) \n\n## 支持平台\n\n\u003e 在尝试了各种方法之后，GitHub Actions 在 Windows 平台下始终无法正确编译 C++，所以放弃支持 Windows 平台\n\n+ Linux\n+ macOS\n\n## 安装\n\n```bash\npip install flow-network\n```\n\n## 样例代码\n\n```python\nfrom flow_network import MaximumFlow, MinimumCostFlow\n\nmf = MaximumFlow(2)  # 创建一个包含 2 个点的网络流对象，下标从 0 开始\nmf.add_edge(0, 1, 3)  # 添加一条从 0 指向 1 的边，容量为 3\nresult = mf.run(0, 1)  # 指定源点为 0，汇点为 1，跑最大流 \u0026 最小割\nprint(result)  # 3\n\nfor edge in mf.edges:  # 遍历每条边\n    print(edge.u, edge.v, edge.flow, edge.capacity)  # 边的起点、终点、流过的流量、最大容量\n\nmcf = MinimumCostFlow(2)  # 创建一个包含 2 个点的费用流对象，下标从 0 开始\nmcf.add_edge(0, 1, 3, 2)  # 添加一条从 0 指向 1 的边，容量为 3，单位流量的费用为 2\nflow, cost = mcf.run(0, 1)  # 指定源点为 0，汇点为 1，跑最大流 \u0026 最小费\nprint(flow, cost)  # 3 6\n\nfor edge in mcf.edges:\n    print(edge.u, edge.v, edge.flow, edge.capacity, edge.cost)  # 边的起点、终点、流过的流量、最大容量、单位流量的费用\n```\n\n### 测试代码\n\n[tests.py](./flow_network/tests.py)\n\n## Reference\n\n+ [How to use C++ classes with ctypes?](https://stackoverflow.com/questions/1615813/how-to-use-c-classes-with-ctypes)\n+ [Calling C/C++ from Python?](https://stackoverflow.com/questions/145270/calling-c-c-from-python)\n+ [C Class Instance from Void Pointer using Ctypes](https://stackoverflow.com/questions/19389124/c-class-instance-from-void-pointer-using-ctypes)\n+ [Python 库打包分发、setup.py 编写、混合 C 扩展打包的简易指南（转载）](https://www.cnblogs.com/xueweihan/p/12030457.html)\n+ [Binary wheel can't be uploaded on pypi using twine](https://stackoverflow.com/questions/59451069/binary-wheel-cant-be-uploaded-on-pypi-using-twine)\n+ [Manylinux wheel builder](https://github.com/Niraj-Kamdar/manylinux-wheel-builder)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucienshui%2Fflow-network","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucienshui%2Fflow-network","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucienshui%2Fflow-network/lists"}