A simple graph library with DFS, BFS, and cycle detection.
Project description
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:
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))
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_xgraph-1.0.1.tar.gz.
File metadata
- Download URL: python_xgraph-1.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d96bc10ddc88186eeeeed153b827d4b5694e9d76fb0e63662be21e26e8429a28
|
|
| MD5 |
a0f4565014cf4819f7a9506eb48ec052
|
|
| BLAKE2b-256 |
d5420e1c5634122a19b456344d88e57ba9358c070ff814935149b5c9de98ef0c
|
File details
Details for the file python_xgraph-1.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: python_xgraph-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5901c087431346c0702d2edef5bc85a373693c1aa7dff1be35525e6b3a6a9502
|
|
| MD5 |
a5b5b7431330a5d385d11ae6f60377ef
|
|
| BLAKE2b-256 |
5d94303356e324912755b783a6dbe2f3ca034de0347c9af3f03981839b7c5067
|