Skip to content
Merged
8 changes: 4 additions & 4 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Add conda to system path
- name: Check python version
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
python_version=$(python --version)
echo "Python version $python_version"
- name: Install dependencies
run: |
python -m pip install pandas pydot Pillow
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed:
- Misc: Documentation to update mkdocs-material version for social plugin.
- Misc: Update links in README.

## [0.17.2] - 2024-04-24
### Changed:
Expand All @@ -20,6 +23,7 @@ This will also affect showing/printing of trees when `attr_omit_null` is set to
### Fixed
- [#222] Tree Constructor: `dataframe_to_tree_by_relation` duplicate root node name error message to handle
different data types.
- Misc: Update links in README.

## [0.17.0] - 2024-04-04
### Added
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ It is pythonic, making it easy to learn and extendable to many types of workflow
----

Related Links:
- [Documentation](https://bigtree.readthedocs.io/en/latest/)
- [Documentation](https://bigtree.readthedocs.io/)
- [GitHub](https://github.com/kayjan/bigtree/)
- Community
- [Issues](https://github.com/kayjan/bigtree/issues)
/ [Discussions](https://github.com/kayjan/bigtree/discussions)
/ [Changelog](https://github.com/kayjan/bigtree/blob/master/CHANGELOG.md)
/ [Contributing](https://bigtree.readthedocs.io/en/latest/contributing/)
/ [Contributing](https://bigtree.readthedocs.io/en/stable/contributing/)
- Package
- [PyPI](https://pypi.org/project/bigtree/)
/ [Conda](https://anaconda.org/conda-forge/bigtree)
Expand All @@ -29,10 +29,10 @@ There are 3 segments to Big Tree consisting of Tree, Binary Tree, and Directed A

For **Tree** implementation, there are 9 main components.

1. [**🌺 Node**](https://bigtree.readthedocs.io/en/latest/bigtree/node/)
1. [**🌺 Node**](https://bigtree.readthedocs.io/en/stable/bigtree/node/)
1. ``BaseNode``, extendable class
2. ``Node``, BaseNode with node name attribute
2. [**✨ Constructing Tree**](https://bigtree.readthedocs.io/en/latest/bigtree/tree/construct/)
2. [**✨ Constructing Tree**](https://bigtree.readthedocs.io/en/stable/bigtree/tree/construct/)
1. From `Node`, using parent and children constructors
2. From *str*, using tree display or Newick string notation
3. From *list*, using paths or parent-child tuples
Expand All @@ -41,65 +41,65 @@ For **Tree** implementation, there are 9 main components.
6. Add nodes to existing tree using path string
7. Add nodes and attributes to existing tree using *dictionary* or *pandas DataFrame*, using path
8. Add only attributes to existing tree using *dictionary* or *pandas DataFrame*, using node name
3. [**➰ Traversing Tree**](https://bigtree.readthedocs.io/en/latest/bigtree/utils/iterators/)
3. [**➰ Traversing Tree**](https://bigtree.readthedocs.io/en/stable/bigtree/utils/iterators/)
1. Pre-Order Traversal
2. Post-Order Traversal
3. Level-Order Traversal
4. Level-Order-Group Traversal
5. ZigZag Traversal
6. ZigZag-Group Traversal
4. [**📝 Modifying Tree**](https://bigtree.readthedocs.io/en/latest/bigtree/tree/modify/)
4. [**📝 Modifying Tree**](https://bigtree.readthedocs.io/en/stable/bigtree/tree/modify/)
1. Copy nodes from location to destination
2. Shift nodes from location to destination
3. Shift and replace nodes from location to destination
4. Copy nodes from one tree to another
5. Copy and replace nodes from one tree to another
5. [**🔍 Tree Search**](https://bigtree.readthedocs.io/en/latest/bigtree/tree/search/)
5. [**🔍 Tree Search**](https://bigtree.readthedocs.io/en/stable/bigtree/tree/search/)
1. Find multiple nodes based on name, partial path, relative path, attribute value, user-defined condition
2. Find single nodes based on name, partial path, relative path, full path, attribute value, user-defined condition
3. Find multiple child nodes based on user-defined condition
4. Find single child node based on name, user-defined condition
6. [**🔧 Helper Function**](https://bigtree.readthedocs.io/en/latest/bigtree/tree/helper/)
6. [**🔧 Helper Function**](https://bigtree.readthedocs.io/en/stable/bigtree/tree/helper/)
1. Cloning tree to another `Node` type
2. Get subtree (smaller tree with different root)
3. Prune tree (smaller tree with same root)
4. Get difference between two trees
7. [**📊 Plotting Tree**](https://bigtree.readthedocs.io/en/latest/bigtree/utils/plot/)
7. [**📊 Plotting Tree**](https://bigtree.readthedocs.io/en/stable/bigtree/utils/plot/)
1. Enhanced Reingold Tilford Algorithm to retrieve (x, y) coordinates for a tree structure
8. [**🔨 Exporting Tree**](https://bigtree.readthedocs.io/en/latest/bigtree/tree/export/)
8. [**🔨 Exporting Tree**](https://bigtree.readthedocs.io/en/stable/bigtree/tree/export/)
1. Print to console, in vertical or horizontal orientation
2. Export to *Newick string notation*, *dictionary*, *nested dictionary*, or *pandas DataFrame*
3. Export tree to *dot* (can save to .dot, .png, .svg, .jpeg files)
4. Export tree to *Pillow* (can save to .png, .jpg)
5. Export tree to *Mermaid Flowchart* (can display on .md)
9. [**✔️ Workflows**](https://bigtree.readthedocs.io/en/latest/demo/workflow/)
9. [**✔️ Workflows**](https://bigtree.readthedocs.io/en/stable/demo/workflow/)
1. Sample workflows for tree demonstration!

--------

For **Binary Tree** implementation, there are 3 main components.
Binary Node inherits from Node, so the components in Tree implementation are also available in Binary Tree.

1. [**🌿 Node**](https://bigtree.readthedocs.io/en/latest/bigtree/node/)
1. [**🌿 Node**](https://bigtree.readthedocs.io/en/stable/bigtree/node/)
1. ``BinaryNode``, Node with binary tree rules
2. [**✨ Constructing Binary Tree**](https://bigtree.readthedocs.io/en/latest/bigtree/binarytree/construct/)
2. [**✨ Constructing Binary Tree**](https://bigtree.readthedocs.io/en/stable/bigtree/binarytree/construct/)
1. From *list*, using flattened list structure
3. [**➰ Traversing Binary Tree**](https://bigtree.readthedocs.io/en/latest/bigtree/utils/iterators/)
3. [**➰ Traversing Binary Tree**](https://bigtree.readthedocs.io/en/stable/bigtree/utils/iterators/)
1. In-Order Traversal

-----

For **Directed Acyclic Graph (DAG)** implementation, there are 4 main components.

1. [**🌼 Node**](https://bigtree.readthedocs.io/en/latest/bigtree/node/)
1. [**🌼 Node**](https://bigtree.readthedocs.io/en/stable/bigtree/node/)
1. ``DAGNode``, extendable class for constructing Directed Acyclic Graph (DAG)
2. [**✨ Constructing DAG**](https://bigtree.readthedocs.io/en/latest/bigtree/dag/construct/)
2. [**✨ Constructing DAG**](https://bigtree.readthedocs.io/en/stable/bigtree/dag/construct/)
1. From *list*, containing parent-child tuples
2. From *nested dictionary*
3. From *pandas DataFrame*
3. [**➰ Traversing DAG**](https://bigtree.readthedocs.io/en/latest/bigtree/utils/iterators/)
3. [**➰ Traversing DAG**](https://bigtree.readthedocs.io/en/stable/bigtree/utils/iterators/)
1. Generic traversal method
4. [**🔨 Exporting DAG**](https://bigtree.readthedocs.io/en/latest/bigtree/dag/export/)
4. [**🔨 Exporting DAG**](https://bigtree.readthedocs.io/en/stable/bigtree/dag/export/)
1. Export to *list*, *dictionary*, or *pandas DataFrame*
2. Export DAG to *dot* (can save to .dot, .png, .svg, .jpeg files)

Expand Down
24 changes: 12 additions & 12 deletions tests/dag/test_construct.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import unittest

import pandas as pd
Expand Down Expand Up @@ -203,18 +204,17 @@ def test_dataframe_to_dag_zero_attribute():
dag = dataframe_to_dag(data)
assert_dag_structure_root(dag)
for parent, _ in dag_iterator(dag):
match parent.name:
case "a":
assert hasattr(
parent, "value"
), "Check a attribute, expected value attribute"
assert parent.value == 0, "Check a value, expected 0"
case "b":
assert not hasattr(
parent, "value"
), "Check b attribute, expected no value attribute"
case "c":
assert parent.value == -1, "Check c value, expected -1"
if parent.name == "a":
assert hasattr(
parent, "value"
), "Check a attribute, expected value attribute"
assert parent.value == 0, "Check a value, expected 0"
elif parent.name == "b":
assert not hasattr(
parent, "value"
), "Check b attribute, expected no value attribute"
elif parent.name == "c":
assert parent.value == -1, "Check c value, expected -1"

def test_dataframe_to_dag_empty_row_error(self):
with pytest.raises(ValueError) as exc_info:
Expand Down