# python-xgraph
`python-xgraph` is a simple Python library for working with graphs. It provides basic functionalities like adding vertices and edges, performing DFS and BFS, detecting cycles, and more.
## Installation
You can install the package via pip:
```bash
pip install python-xgraph
```
## Usage
```
from python_xgraph import Graph
g = Graph(directed=True)
g.add_vertex("A")
g.add_edge("A", "B")
print(g.dfs("A"))
```
Initialize using a dictionary
```
from python_xgraph import Graph
g = Graph({"A":["B","C"], "B":["D","E"], "C":["X","Y"]}, directed=True)
print(g.has_cycle())
print(g.topological_sort(reverse=True))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/sinha-abhishek-ai/python-xGraph",
"name": "python-xgraph",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "graph, DFS, BFS, cycle detection, topological sort",
"author": "Abhishek Sinha",
"author_email": "sinha.abhishek.ai@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/04/59/2db8a8474482de152a6b74757bd6cdc52b40a6761769f0a7d173e7ad50f1/python_xgraph-1.0.2.tar.gz",
"platform": null,
"description": "# python-xgraph\n\n`python-xgraph` is a simple Python library for working with graphs. It provides basic functionalities like adding vertices and edges, performing DFS and BFS, detecting cycles, and more.\n\n## Installation\n\nYou can install the package via pip:\n\n```bash\npip install python-xgraph\n```\n\n## Usage\n\n```\nfrom python_xgraph import Graph\n\ng = Graph(directed=True)\ng.add_vertex(\"A\")\ng.add_edge(\"A\", \"B\")\nprint(g.dfs(\"A\"))\n```\n\nInitialize using a dictionary\n```\nfrom python_xgraph import Graph\n\ng = Graph({\"A\":[\"B\",\"C\"], \"B\":[\"D\",\"E\"], \"C\":[\"X\",\"Y\"]}, directed=True)\n\nprint(g.has_cycle())\nprint(g.topological_sort(reverse=True))\n\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple graph library with DFS, BFS, and cycle detection.",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://github.com/sinha-abhishek-ai/python-xGraph"
},
"split_keywords": [
"graph",
" dfs",
" bfs",
" cycle detection",
" topological sort"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9dc66512df44bca8adbf676a1e0650a50f439cfb86a3aa80f5290ca495154247",
"md5": "0a52351bd5e6d86fbb89a87cbe981135",
"sha256": "6fe513dab0ce325af58b73a9e64867fed4294efcaa6772527468a76e0b96d75c"
},
"downloads": -1,
"filename": "python_xgraph-1.0.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "0a52351bd5e6d86fbb89a87cbe981135",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 6302,
"upload_time": "2024-09-10T07:00:14",
"upload_time_iso_8601": "2024-09-10T07:00:14.080187Z",
"url": "https://files.pythonhosted.org/packages/9d/c6/6512df44bca8adbf676a1e0650a50f439cfb86a3aa80f5290ca495154247/python_xgraph-1.0.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "04592db8a8474482de152a6b74757bd6cdc52b40a6761769f0a7d173e7ad50f1",
"md5": "1f768cba63438456fab070c466458646",
"sha256": "1a479aef1230796d8fbf0afcf2c1fa7912747a4bbf7a6950a9e7ab4ad5af526c"
},
"downloads": -1,
"filename": "python_xgraph-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "1f768cba63438456fab070c466458646",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5945,
"upload_time": "2024-09-10T07:00:15",
"upload_time_iso_8601": "2024-09-10T07:00:15.583334Z",
"url": "https://files.pythonhosted.org/packages/04/59/2db8a8474482de152a6b74757bd6cdc52b40a6761769f0a7d173e7ad50f1/python_xgraph-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-10 07:00:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sinha-abhishek-ai",
"github_project": "python-xGraph",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "python-xgraph"
}