Skip to main content

A package to traverse nested JSON data structures using BFS or DFS algorithms

Project description

from json_graph_traversal import JSONGraphTraversal

Create a JSONGraphTraversal object from a dictionary

data = { "name": "root", "children": [ { "name": "child1", "children": [ {"name": "grandchild1", "value": 1}, {"name": "grandchild2", "value": 2} ] }, { "name": "child2", "value": 3 } ] }

traversal = JSONGraphTraversal(data)

Perform BFS traversal

print("BFS Traversal:") for path, value in traversal.bfs(): print(f"Path: {path}, Value: {value}")

Perform DFS traversal

print("\nDFS Traversal:") for path, value in traversal.dfs(): print(f"Path: {path}, Value: {value}")

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

json_graph_traversal-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

json_graph_traversal-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file json_graph_traversal-0.1.0.tar.gz.

File metadata

  • Download URL: json_graph_traversal-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for json_graph_traversal-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dec6f371266fde54b5faec1a0edca3e3fa9657697ac95655f3f425acdc41f0bf
MD5 2b0befbea2a6c58c5d10deed6b78f1b6
BLAKE2b-256 6c5f0bbe2921a450550df4ba9b7525c57891ff441a847d42641109b7d933e848

See more details on using hashes here.

File details

Details for the file json_graph_traversal-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for json_graph_traversal-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8304ec8b8935912b953182b1a5c2e7488671573058e8db1182d484cb52ee475
MD5 cf909b3d360b89c17a577354eafae4bc
BLAKE2b-256 9d8b7e0aa6cc945d3a8f43f64ed2ea29bea154f4c6e7b29a32eccfecc1dc56ad

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