Skip to main content

Adaptive Graph Engine

A lightweight Python graph engine for modelling directed graphs, dependencies, relationships and weighted paths.

Features

  • Directed graph representation
  • Nodes and edges
  • Edge weights
  • Relationship metadata
  • Neighbour lookup
  • Predecessor and successor lookup
  • Breadth-First Search (BFS)
  • Depth-First Search (DFS)
  • Dijkstra shortest weighted path
  • Directed cycle detection
  • Topological sorting

Installation

pip install adaptive-graph-engine

Basic Usage

from adaptive_graph_engine import Graph

graph = Graph()

graph.add_edge(
    "salesforce",
    "customer_raw",
    metadata={"relationship": "INGESTS_TO"}
)

graph.add_edge(
    "customer_raw",
    "customer_clean",
    metadata={"relationship": "TRANSFORMS_TO"}
)

print(graph.get_neighbors("salesforce"))

Output:

['customer_raw']

Graph Algorithms

Algorithms are available from adaptive_graph_engine.algorithms.

Find a path with the fewest hops.

from adaptive_graph_engine.algorithms import find_shortest_path

path = find_shortest_path(
    graph,
    "salesforce",
    "customer_clean"
)

Explore a graph using depth-first traversal.

from adaptive_graph_engine.algorithms import find_depth_first

path = find_depth_first(
    graph,
    "salesforce",
    "customer_clean"
)

Dijkstra

Find the lowest-cost path using edge weights.

from adaptive_graph_engine.algorithms import dijkstra

result = dijkstra(
    graph,
    "salesforce",
    "customer_clean"
)

Dijkstra returns the path and its total cost.

Cycle Detection

from adaptive_graph_engine.algorithms import has_cycle

contains_cycle = has_cycle(graph)

Topological Sort

from adaptive_graph_engine.algorithms import topological_sort

order = topological_sort(graph)

Topological sorting returns None when the directed graph contains a cycle.

Example Use Cases

Adaptive Graph Engine can be used as a foundation for:

  • Dependency graphs
  • Data lineage
  • Provenance graphs
  • Workflow dependencies
  • Knowledge graph infrastructure
  • Relationship-based systems

Requirements

Python 3.11 or later.

Version

Current release: 0.2.0

Author

Yassine Chaachaa

License

MIT

Release files for adaptive-graph-engine 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adaptive-graph-engine 0.2.0
File Size Uploaded
adaptive_graph_engine-0.2.0.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for adaptive-graph-engine 0.2.0
File Interpreter ABI Platform
adaptive_graph_engine-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / adaptive_graph_engine-0.2.0.tar.gz

Download URL adaptive_graph_engine-0.2.0.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
71e1ba42042efcd012b0165c4e2c7c845ab42d1047c7e8e06f041f5a9b286769
BLAKE2b-256 checksum
How to use checksums
28db2b056835629d1aa85f225ca4a8ba55bc06b0cc8d1a32bf4ac8236ca43587
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / adaptive_graph_engine-0.2.0-py3-none-any.whl

Download URL adaptive_graph_engine-0.2.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81e55b053d33cdde30abbb0bde10229a43f0ca72522a307e40d81afe76376023
BLAKE2b-256 checksum
How to use checksums
a1561c782cbf9daa0c55ebbaeed00fc81720e4f01fc90058ed24c20389138057
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page