# Small Graph Lib
## Installing
$ git clone https://github.com/wxgeo/smallgraphlib
$ pip install --user smallgraphlib
## Usage
Main classes are `Graph`, `DirectedGraph`, `WeightedGraph` and `WeightedDirectedGraph`:
>>> from smallgraphlib import DirectedGraph
>>> g = DirectedGraph(["A", "B", "C"], ("A", "B"), ("B", "A"), ("B", "C"))
>>> g.is_simple
True
>>> g.is_complete
False
>>> g.is_directed
True
>>> g.adjacency_matrix
[[0, 1, 0], [1, 0, 1], [0, 0, 0]]
>>> g.degree
3
>>> g.order
3
>>> g.is_eulerian
False
>>> g.is_semi_eulerian
True
Special graphs may be generated using factory functions:
>>> from smallgraphlib import complete_graph, complete_bipartite_graph
>>> K5 = complete_graph(5)
>>> len(K5.greedy_coloring)
5
>>> K33 = complete_bipartite_graph(3, 3)
>>> K33.degree
6
>>> K33.diameter
2
If the graph is not too complex, Tikz code may be generated:
>>> g.as_tikz()
...
## Development
1. Get last version:
$ git clone https://github.com/wxgeo/smallgraphlib
2. Install Poetry.
Poetry is a tool for dependency management and packaging in Python.
Installation instructions are here:
https://python-poetry.org/docs/#installation
3. Install developments tools:
$ poetry install
4. Optionally, update development tools:
$ poetry update
5. Optionally, install library in editable mode:
$ pip install -e smallgraphlib
6. Make changes, add tests.
7. Launch tests:
$ tox
8. Everything's OK ? Commit. :)
Raw data
{
"_id": null,
"home_page": "https://github.com/wxgeo/smallgraphlib",
"name": "smallgraphlib",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "graph, tikz, latex",
"author": "Nicolas Pourcelot",
"author_email": "nicolas.pourcelot@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ae/fa/de3776859e4ccccd1498a2a7e5cb04cac68ca650e1023089c794b0b68405/smallgraphlib-0.10.0.tar.gz",
"platform": null,
"description": "# Small Graph Lib\n\n## Installing\n\n $ git clone https://github.com/wxgeo/smallgraphlib\n\n $ pip install --user smallgraphlib\n\n## Usage\n\nMain classes are `Graph`, `DirectedGraph`, `WeightedGraph` and `WeightedDirectedGraph`:\n\n >>> from smallgraphlib import DirectedGraph\n >>> g = DirectedGraph([\"A\", \"B\", \"C\"], (\"A\", \"B\"), (\"B\", \"A\"), (\"B\", \"C\"))\n >>> g.is_simple\n True\n >>> g.is_complete\n False\n >>> g.is_directed\n True\n >>> g.adjacency_matrix\n [[0, 1, 0], [1, 0, 1], [0, 0, 0]]\n >>> g.degree\n 3\n >>> g.order\n 3\n >>> g.is_eulerian\n False\n >>> g.is_semi_eulerian\n True\n\nSpecial graphs may be generated using factory functions:\n \n >>> from smallgraphlib import complete_graph, complete_bipartite_graph\n >>> K5 = complete_graph(5)\n >>> len(K5.greedy_coloring)\n 5\n >>> K33 = complete_bipartite_graph(3, 3)\n >>> K33.degree\n 6\n >>> K33.diameter\n 2\n \nIf the graph is not too complex, Tikz code may be generated:\n\n >>> g.as_tikz()\n ...\n\n## Development\n\n1. Get last version:\n \n $ git clone https://github.com/wxgeo/smallgraphlib\n\n2. Install Poetry.\n \n Poetry is a tool for dependency management and packaging in Python.\n\n Installation instructions are here:\n https://python-poetry.org/docs/#installation\n\n3. Install developments tools:\n \n $ poetry install\n\n4. Optionally, update development tools:\n \n $ poetry update\n\n5. Optionally, install library in editable mode:\n\n $ pip install -e smallgraphlib\n\n6. Make changes, add tests.\n \n7. Launch tests:\n\n $ tox\n\n8. Everything's OK ? Commit. :)",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "Simple library for handling small graphs, including Tikz code generation.",
"version": "0.10.0",
"project_urls": {
"Homepage": "https://github.com/wxgeo/smallgraphlib",
"Repository": "https://github.com/wxgeo/smallgraphlib"
},
"split_keywords": [
"graph",
" tikz",
" latex"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "01ce146efce4a47acd78618244224758568616a2b8830998d0fa78227fc8651d",
"md5": "5677bf6dd2391754b6c6a7795717960d",
"sha256": "2b45f1d69f511efb0d21fd0e1d52fe825862d8b24420510cc4f545154e531b81"
},
"downloads": -1,
"filename": "smallgraphlib-0.10.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5677bf6dd2391754b6c6a7795717960d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 46029,
"upload_time": "2024-04-08T21:08:18",
"upload_time_iso_8601": "2024-04-08T21:08:18.609634Z",
"url": "https://files.pythonhosted.org/packages/01/ce/146efce4a47acd78618244224758568616a2b8830998d0fa78227fc8651d/smallgraphlib-0.10.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aefade3776859e4ccccd1498a2a7e5cb04cac68ca650e1023089c794b0b68405",
"md5": "23b2292cf383a3345015b85fdd130686",
"sha256": "afa541aba68aade0ceb415fb722ecf522210044eb111c2c74d181fda5990172c"
},
"downloads": -1,
"filename": "smallgraphlib-0.10.0.tar.gz",
"has_sig": false,
"md5_digest": "23b2292cf383a3345015b85fdd130686",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 40279,
"upload_time": "2024-04-08T21:08:22",
"upload_time_iso_8601": "2024-04-08T21:08:22.307290Z",
"url": "https://files.pythonhosted.org/packages/ae/fa/de3776859e4ccccd1498a2a7e5cb04cac68ca650e1023089c794b0b68405/smallgraphlib-0.10.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-08 21:08:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wxgeo",
"github_project": "smallgraphlib",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "smallgraphlib"
}