Metadata-Version: 2.4
Name: dtree-explorer
Version: 1.0.1
Summary: DTree Explorer: encode a directed tree with DTree's two projections (Q1, Q2) and watch it step by step, in the browser
Author-email: Enis Olgac <enis@digraphs.info>
License: MIT
Project-URL: Homepage, https://github.com/EnisOlgac/DTree-Explorer
Project-URL: Library, https://github.com/EnisOlgac/DTree
Project-URL: Online, https://digraphs.blog/dtree-demo/
Project-URL: Paper, https://doi.org/10.5772/intechopen.1013408
Keywords: directed tree,tree topology,reachability,visualization,incremental encoding,teaching
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: dtree-encoding>=1.8.0
Dynamic: license-file

# DTree Explorer

Encode a directed tree with [DTree](https://github.com/EnisOlgac/DTree)'s two projections Q1 and Q2 and watch it happen, edge by edge. The Explorer draws the tree, places every node in the plane at its rank in Q1 and Q2, lists both projections with the positions the library stores, and answers reachability questions by clicking: *u* reaches *v* exactly when *u* comes before *v* in both lists.

Every tree is computed by the published library, [dtree-encoding](https://pypi.org/project/dtree-encoding/); the Explorer only shows what it computes.

## Three ways to use it

**Online:** [digraphs.blog/dtree-demo](https://digraphs.blog/dtree-demo/), nothing to install.

**As a Python program**, offline, with the library installed on your machine:

```
pip install dtree-explorer
dtree-explorer
```

The command starts a small server on 127.0.0.1 and opens the page in your browser; stop it with Ctrl+C. Options: `--port 8765`, `--no-browser`, `--save explorer.html` (write the page as one file).

**As a single file:** download `DTree-Explorer.html` from the [latest release](https://github.com/EnisOlgac/DTree-Explorer/releases/latest) and open it in a browser. It loads Python (Pyodide) from cdn.jsdelivr.net and dtree-encoding from pypi.org, so it needs an internet connection.

## Input

One line per instruction; lines starting with `#` are comments.

| Line | Meaning |
|---|---|
| `p: c1; c2` | c1 and c2 become the last children of p |
| `s > c1; c2` | c1 goes directly after its sibling s, then c2 after c1 |
| `s < c1; c2` | c1 and c2 go directly before s, in that order |

The examples include the trees of the paper: the introductory example, Figure 1, the generalized insertion of Section 4.1 (Case A, before; Case B, after) and Appendix A, whose three variants appear twice: once by the order of the input lines, once with `<` and `>`. Both give the same projections.

## Privacy

Your tree stays on your computer. The page counts visits only in the copy on digraphs.blog, with Google Analytics and only after you agree; the package and the release file count nothing.

## Building

Working in this repository needs the library installed: `pip install dtree-encoding`. `src/template.html` is the page, `dtree_explorer/bridge.py` the Python part it runs, `src/build.py` assembles `dtree_explorer/explorer.html` (package and release) and `site/index.html` (digraphs.blog) with the installed dtree-encoding. Tests: `python -m unittest discover -s tests`.

## Background

E. Olgac, "Topology and Structure of Directed Trees: An Incremental Encoding," IntechOpen, 2025. doi: [10.5772/intechopen.1013408](https://doi.org/10.5772/intechopen.1013408).

## License

MIT. Design and concept: Enis Olgac. The Explorer was written with Claude (Anthropic).
