Name | kcol-graph-gen JSON |
Version |
1.0.0
JSON |
| download |
home_page | |
Summary | Generate a k-colarable graph. |
upload_time | 2023-05-14 18:40:24 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.7 |
license | MIT License Copyright (c) 2023 Deep Raval Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
k-colrable
graph-coloring
chromatic number
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# kcol_graph_gen
![alt text](./assets/cover.png "Cover Logo")
_A minimalistic python package to generate a k-colorable graph._
# Installation
Just run `pip install kcol-graph-gen` and you are good to go!
# Usage
Before generating the graph you have to make an object of the class `KColorableGraphGenerator`. You can specify an optional `seed` for the default `random` package which is used during the generation of the graph.
Once the object is crated, you can use `generate` method to generate the graphs. This takes three arguments `n` : number of vertices, `k` : specifying the number of colors, `p(optional, default=0.5)` : Probability with which any edge is added into the graph. Higher the value of `p` denser the resulting graph will be.
Below is the code snippet which demonstrates the usage:
```
from kcol_graph_gen import KColorableGraphGenerator
generator = KColorableGraphGenerator(seed=42)
edges = generator.generate(4, 2, 0.3) # Create a bipartite graph
print(edges) # Printing the list of edges
# > [(2, 3), (2, 4), (1, 2)]
edges = generator.generate(
6, 3, 0.9
) # Create a 3-colorable dense graph with 6 vertices
print(edges) # Printing the list of edges
# > [(2, 4), (1, 2), (3, 4), (1, 5), (2, 3), (4, 5), (2, 6), (5, 6), (3, 6), (2, 5), (1, 3)]
```
Raw data
{
"_id": null,
"home_page": "",
"name": "kcol-graph-gen",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "k-colrable,graph-coloring,chromatic number",
"author": "",
"author_email": "Deep Raval <deepraval2905@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c0/05/88a064be6f2b44b4caa37e0901526c64d269486f004fdc03fa2c671740bf/kcol-graph-gen-1.0.0.tar.gz",
"platform": null,
"description": "# kcol_graph_gen\r\n\r\n![alt text](./assets/cover.png \"Cover Logo\")\r\n_A minimalistic python package to generate a k-colorable graph._\r\n\r\n# Installation\r\n\r\nJust run `pip install kcol-graph-gen` and you are good to go!\r\n\r\n# Usage\r\n\r\nBefore generating the graph you have to make an object of the class `KColorableGraphGenerator`. You can specify an optional `seed` for the default `random` package which is used during the generation of the graph.\r\n\r\nOnce the object is crated, you can use `generate` method to generate the graphs. This takes three arguments `n` : number of vertices, `k` : specifying the number of colors, `p(optional, default=0.5)` : Probability with which any edge is added into the graph. Higher the value of `p` denser the resulting graph will be.\r\n\r\nBelow is the code snippet which demonstrates the usage:\r\n\r\n```\r\nfrom kcol_graph_gen import KColorableGraphGenerator\r\n\r\ngenerator = KColorableGraphGenerator(seed=42)\r\nedges = generator.generate(4, 2, 0.3) # Create a bipartite graph\r\n\r\nprint(edges) # Printing the list of edges\r\n# > [(2, 3), (2, 4), (1, 2)]\r\n\r\nedges = generator.generate(\r\n 6, 3, 0.9\r\n) # Create a 3-colorable dense graph with 6 vertices\r\n\r\nprint(edges) # Printing the list of edges\r\n# > [(2, 4), (1, 2), (3, 4), (1, 5), (2, 3), (4, 5), (2, 6), (5, 6), (3, 6), (2, 5), (1, 3)]\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2023 Deep Raval Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Generate a k-colarable graph.",
"version": "1.0.0",
"project_urls": {
"documentation": "https://github.com/imdeep2905/kcol-graph/blob/main/README.md",
"repository": "https://github.com/imdeep2905/kcol-graph"
},
"split_keywords": [
"k-colrable",
"graph-coloring",
"chromatic number"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7b90d6b5d36c9f2165a980ee9912e4e59181235936c0be2794e7fa32132f21f4",
"md5": "36552b1f04bd71bf902efc0447391771",
"sha256": "14ba8b089323c8801a7998547b44883ba705eaae8fe6959c1ea30ee1b47a3869"
},
"downloads": -1,
"filename": "kcol_graph_gen-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "36552b1f04bd71bf902efc0447391771",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4725,
"upload_time": "2023-05-14T18:40:22",
"upload_time_iso_8601": "2023-05-14T18:40:22.070050Z",
"url": "https://files.pythonhosted.org/packages/7b/90/d6b5d36c9f2165a980ee9912e4e59181235936c0be2794e7fa32132f21f4/kcol_graph_gen-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c00588a064be6f2b44b4caa37e0901526c64d269486f004fdc03fa2c671740bf",
"md5": "22d341025f52cdad5a6d78bb4ac0f6b3",
"sha256": "7b6738940bcb5ca782d6b67af9b9304b7d61f98d9da3d982d08e5f6856c40240"
},
"downloads": -1,
"filename": "kcol-graph-gen-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "22d341025f52cdad5a6d78bb4ac0f6b3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4174,
"upload_time": "2023-05-14T18:40:24",
"upload_time_iso_8601": "2023-05-14T18:40:24.540923Z",
"url": "https://files.pythonhosted.org/packages/c0/05/88a064be6f2b44b4caa37e0901526c64d269486f004fdc03fa2c671740bf/kcol-graph-gen-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-14 18:40:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "imdeep2905",
"github_project": "kcol-graph",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "kcol-graph-gen"
}