{"id":37763683,"url":"https://github.com/adam-rumpf/pynetgen","last_synced_at":"2026-01-16T14:40:04.513Z","repository":{"id":41570117,"uuid":"378829136","full_name":"adam-rumpf/pynetgen","owner":"adam-rumpf","description":"A Python module for generating random network flows problem instances in DIMACS graph format.","archived":false,"fork":false,"pushed_at":"2023-01-01T19:38:21.000Z","size":104,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-20T21:52:55.978Z","etag":null,"topics":["graph-theory","math","netgen","network-flows","operations-research","problem-instances","random-graph"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pynetgen/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adam-rumpf.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":"2021-06-21T06:28:24.000Z","updated_at":"2023-12-26T11:25:58.000Z","dependencies_parsed_at":"2023-02-01T00:30:38.560Z","dependency_job_id":null,"html_url":"https://github.com/adam-rumpf/pynetgen","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/adam-rumpf/pynetgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adam-rumpf%2Fpynetgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adam-rumpf%2Fpynetgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adam-rumpf%2Fpynetgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adam-rumpf%2Fpynetgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adam-rumpf","download_url":"https://codeload.github.com/adam-rumpf/pynetgen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adam-rumpf%2Fpynetgen/sbom","scorecard":{"id":164733,"data":{"date":"2025-08-11","repo":{"name":"github.com/adam-rumpf/pynetgen","commit":"f6be5bb13324071290e82fe37929b243f9544fb6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"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":-1,"reason":"no workflows found","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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"Code-Review","score":0,"reason":"Found 0/30 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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: 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":"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":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.0.0 not signed: https://api.github.com/repos/adam-rumpf/pynetgen/releases/73303185","Warn: release artifact v0.3.0 not signed: https://api.github.com/repos/adam-rumpf/pynetgen/releases/72684405","Warn: release artifact v1.0.0 does not have provenance: https://api.github.com/repos/adam-rumpf/pynetgen/releases/73303185","Warn: release artifact v0.3.0 does not have provenance: https://api.github.com/repos/adam-rumpf/pynetgen/releases/72684405"],"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"}}]},"last_synced_at":"2025-08-16T14:30:35.875Z","repository_id":41570117,"created_at":"2025-08-16T14:30:35.875Z","updated_at":"2025-08-16T14:30:35.875Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"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":["graph-theory","math","netgen","network-flows","operations-research","problem-instances","random-graph"],"created_at":"2026-01-16T14:40:04.419Z","updated_at":"2026-01-16T14:40:04.498Z","avatar_url":"https://github.com/adam-rumpf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyNETGEN\n\n\u003ca href=\"https://pypi.org/project/pynetgen\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/pynetgen?logo=pypi\u0026logoColor=white\"/\u003e\u003c/a\u003e \u003ca href=\"https://github.com/adam-rumpf/pynetgen\"\u003e\u003cimg src=\"https://img.shields.io/github/v/tag/adam-rumpf/pynetgen?logo=github\"\u003e\u003c/a\u003e \u003ca href=\"https://pypi.org/project/pynetgen/#history\"\u003e\u003cimg src=\"https://img.shields.io/pypi/status/pynetgen\"/\u003e\u003c/a\u003e \u003ca href=\"https://www.python.org/\"\u003e\u003cimg src=\"https://img.shields.io/pypi/pyversions/pynetgen?logo=python\u0026logoColor=white\"\u003e\u003c/a\u003e \u003ca href=\"https://github.com/adam-rumpf/pynetgen/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/adam-rumpf/pynetgen\"/\u003e\u003c/a\u003e \u003ca href=\"https://github.com/adam-rumpf/pynetgen/commits/main\"\u003e\u003cimg src=\"https://img.shields.io/maintenance/yes/2022\"/\u003e\u003c/a\u003e\n\nA Python module for generating random network flows problem instances in [DIMACS graph format](#dimacs-file-format), including an implementation of the NETGEN algorithm ([Klingman et al. 1974](https://doi.org/10.1287/mnsc.20.5.814)).\n\n## Introduction\n\nThis package defines a variety of scripts for generating random instances of network flows problems subject to tuneable parameters. This can be accomplished within Python by importing `pynetgen` as a [module](#module-usage), or from the command line by calling `pynetgen` as a [shell script](#command-line-usage).\n\nPyNETGEN began as a Python implementation of NETGEN, a random network flows problem instance generator defined in:\n\n\u003e D. Klingman, A. Napier, and J. Stutz. NETGEN: A Program for generating large scale capacitated assignment, transportation, and minimum cost flow network problems. _Management Science_, 20(5):814-821, 1974. [doi:10.1287/mnsc.20.5.814](https://doi.org/10.1287/mnsc.20.5.814).\n\nThis package's implementation of NETGEN is based on a [C implementation](https://lemon.cs.elte.hu/trac/lemon/browser/lemon-benchmark/generators/netgen) of NETGEN by Norbert Schlenker (1989). The original implementation was used to generate random minimum-cost flow, maximum flow, and assignment problems, exported in DIMACS graph format.\n\nAn alternate network generation algorithm is also included for generating grid-based graphs similar to those described for the test problems of:\n\n\u003e S. Sadeghi, A. Seifi, and E. Azizi. Trilevel shortest path network interdiction with partial fortification. _Computers \u0026 Industrial Engineering_, 106:400-411, 2017. [doi:10.1016/j.cie.2017.02.006](https://doi.org/10.1016/j.cie.2017.02.006).\n\n## Network Generation Algorithms\n\nTwo different random network generation algorithms are defined. Both are capable of generating minimum-cost network flows problems according to a set of tuneable parameters that control things like the size of the network and the acceptable ranges of arc costs and capacities. Both also have measures in place to guarantee that the resulting problem is feasible. To briefly describe each algorithm:\n\n* The NETGEN algorithm (`netgen_generate`) begins by defining source and sink nodes and randomly distributing supply among them. It then generates a set of \"skeleton arcs\" to create paths from the sources to the sinks. Skeleton arcs are guaranteed to have enough capacity to carry all required flow, ensuring that the problem instance is feasible, but they can also be specified to have maximum cost in order to discourage uninteresting solutions that utilize only skeleton arcs. After the skeleton is defined, arcs are randomly generated between pairs of randomly-selected nodes until the desired density is reached.\n* The grid-based algorithm (`grid_generate`) defines a rectangular array of nodes with a specified number of columns and rows. A single master source is placed on one side, and a master sink is placed on the other. Arcs are generated in a square (or square with diagonal) grid pattern, and can be specified to be directed either strictly from the source side to the sink side or in both directions. The \"skeleton arcs\" consist of paths that move along the rows of the network.\n\nBy default both algorithms produce a minimum-cost flow problem instance. If the minimum and maximum arc costs are both set to exactly 1, and if the number of sources does not equal the total supply (easily achieved by setting the supply to 0), then a maximum flow problem is generated instead.\n\n## Usage\n\nPyNETGEN can be installed from [PyPI](https://pypi.org/project/pynetgen) via the console command\n```\n$ pip install pynetgen\n```\n\nAfter installation, PyNETGEN can be used either by importing it as a module or through its shell script.\n\n### Module Usage\n\nPyNETGEN can be imported from within Python using\n```python\nimport pynetgen\n```\nwhich grants access to the two main public functions `netgen_generate()` and `grid_generate()`. For detailed descriptions of the algorithms see their docstrings via `help(netgen_generate)` and `help(grid_generate)`. This includes brief descriptions of the network structures and a detailed lists of network parameters.\n\n### Command Line Usage\n\nPyNETGEN can be run through the command line using the `pynetgen` shell script\n```\n$ pynetgen [-h] [-v] [-q] [-f [FILE]] arg_list [arg_list ...]\n```\nFor basic usage instructions, access the documentation via\n```\n$ pynetgen --help\n```\nFor detailed instructions for the NETGEN and grid-based algorithms, including a brief description of the network's structure and a detailed list of network parameters, use\n```\n$ pynetgen netgen help\n```\nor\n```\n$ pynetgen grid help\n```\n\n## DIMACS File Format\n\nThe resulting network is output as a file in [DIMACS graph format](http://dimacs.rutgers.edu/archive/Challenges/) (or printed to the screen, in case no file path is given). To give a brief description of the format, a DIMACS graph file is a pure text file in which every line begins with either the letter `c`, `p`, `n`, or `a` to specify what type of information it defines.\n\nIn the case of a minimum-cost flows problem, the lines are formatted as follows:\n\n* `c` indicates a comment line. The output file begins with a header made up of comment lines describing the parameters used to generate the problem.\n* `p` indicates the problem definition. This follows the header and has the format `p min NODES DENSITY`, where:\n  * `NODES` is the total number of nodes.\n  * `DENSITY` is the total number of arcs.\n* `n` indicates a node definition. The node definitions follow the problem definition, and have the format `n ID SUPPLY`, where:\n  * `ID` is a unique numerical index given to all nodes (starting at 1).\n  * `SUPPLY` is the supply value of the node (positive for sources, negative for sinks). In order to save space, only nodes with nonzero supply values are included.\n* `a` indicates an arc definition. The arc definitions follow the node definitions, and have the format `a FROM TO MINCAP MAXCAP COST`, where:\n  * `FROM` and `TO` are the node indices of the arc's origin and destination, respectively.\n  * `MINCAP` and `MAXCAP` are the arc's lower and upper capacity bounds, respectively.\n  * `COST` is the arc's unit flow cost.\n\nThe output file for a maximum-flow problem follows the same format with the following exceptions:\n\n* The objective is `max` instead of `min`.\n* Source and sink nodes are given a `SUPPLY` value of `s` or `t`, respectively, rather than a specific number.\n* Arc definitions omit the cost and lower capacity bound, now having the format `a FROM TO MAXCAP`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadam-rumpf%2Fpynetgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadam-rumpf%2Fpynetgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadam-rumpf%2Fpynetgen/lists"}