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.0.tar.gz (5.5 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.0-py2.py3-none-any.whl (5.8 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: python_xgraph-1.0.0.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

Hashes for python_xgraph-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4c21854d7be5759cd6f4919079c8a32583a01d0be1bcdb6912c4d61eefd96e61
MD5 743c0c40992122e8dc4b938518383987
BLAKE2b-256 00cce8d3bd50b2b46dd987740c2c54adf084a0eef2bae80293eb2c309647133d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_xgraph-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7852122aead51a919a4af816116665f06a806bfd9200197545c448b1e8837a00
MD5 ea6555bce6419300332f71d1883dc97a
BLAKE2b-256 a19dc04ab2dab2c00ccb7f8b7b4fdd7704cbb1a450c61340568128f8ac5c02ac

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