Skip to main content

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

python_xgraph-1.0.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_xgraph-1.0.2-py2.py3-none-any.whl (6.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file python_xgraph-1.0.2.tar.gz.

File metadata

  • Download URL: python_xgraph-1.0.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for python_xgraph-1.0.2.tar.gz
Algorithm Hash digest
SHA256 1a479aef1230796d8fbf0afcf2c1fa7912747a4bbf7a6950a9e7ab4ad5af526c
MD5 1f768cba63438456fab070c466458646
BLAKE2b-256 04592db8a8474482de152a6b74757bd6cdc52b40a6761769f0a7d173e7ad50f1

See more details on using hashes here.

File details

Details for the file python_xgraph-1.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for python_xgraph-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6fe513dab0ce325af58b73a9e64867fed4294efcaa6772527468a76e0b96d75c
MD5 0a52351bd5e6d86fbb89a87cbe981135
BLAKE2b-256 9dc66512df44bca8adbf676a1e0650a50f439cfb86a3aa80f5290ca495154247

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page