Tree Diagram Generator

Project Description

This project is a Python-based tool for generating tree diagrams from structured JSON data. It uses NetworkX and Matplotlib for creating and visualising the tree structures, making it suitable for analysing and presenting hierarchical data.

Features

  • Generate tree diagrams from JSON data.
  • Customisable layout and presentation.
  • Support for visualising complex hierarchical structures.

Installation

Prerequisites

  • Python 3.x
  • pip (Python package installer)

Dependencies

Install the required Python packages:

The requirements.txt file includes the following packages:

  • networkx
  • matplotlib

Graphviz Installation

For advanced graph layouts with pygraphviz, install Graphviz:

  • Windows: Download and install from Graphviz's website.
    • Installation via conda is highly recommended on Windows!
  • MacOS: Use Homebrew with brew install graphviz.
  • Linux (Ubuntu/Debian): Use sudo apt install graphviz.

Usage

To generate a tree diagram:

  1. Prepare your JSON data representing the hierarchical structure.
  2. Run the script with the JSON data.
  3. The script will generate and display the tree diagram.

Required JSON Structure

{
    "key": "NodeKey",
    "children": {
        "Child1Key": {
            "key": "Child1Key",
            "children": { ... },
            "otherProperty": "value"
        },
        "Child2Key": {
            "key": "Child2Key",
            "children": { ... },
            "otherProperty": "value"
        }
    },
    "otherProperty": "value"
}

Sample Screenshots

Single Branch (properties off) Figure_1

Multiple Branch (properties on) Figure_2

Customisation

You can customise the tree diagram by modifying the script. The script allows for adjustments in the layout, node properties, and more.

Contributing

Contributions to this project are welcome! Feel free to fork the repository and submit pull requests.

License

This project is open source and available under the MIT License.