Skip to content

Commit 82aab30

Browse files
committed
Changed: Update CSS and README
1 parent e363782 commit 82aab30

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ For **Tree** implementation, there are 9 main components.
6666
7. [**📊 Plotting Tree**](https://bigtree.readthedocs.io/en/latest/bigtree/utils/plot.html)
6767
1. Enhanced Reingold Tilford Algorithm to retrieve (x, y) coordinates for a tree structure
6868
8. [**🔨 Exporting Tree**](https://bigtree.readthedocs.io/en/latest/bigtree/tree/export.html)
69-
1. Print to console
69+
1. Print to console, in vertical or horizontal orientation
7070
2. Export to *Newick string notation*, *dictionary*, *nested dictionary*, or *pandas DataFrame*
7171
3. Export tree to *dot* (can save to .dot, .png, .svg, .jpeg files)
7272
4. Export tree to *Pillow* (can save to .png, .jpg)
@@ -394,12 +394,13 @@ root.show(attr_list=["age"])
394394
395395
### Print Tree
396396

397-
After tree is constructed, it can be viewed by printing to console using `show` method directly.
398-
Alternatively, the `print_tree` method can be used.
397+
After tree is constructed, it can be viewed by printing to console using `show` or `hshow` method directly,
398+
for vertical and horizontal orientation respectively.
399+
Alternatively, the `print_tree` or `hprint_tree` method can be used.
399400

400-
{emphasize-lines="8,16,21,27,34,41,49,56,63,70,77,84,91-95"}
401+
{emphasize-lines="8,15,22,27,33,40,47,55,62,69,76,83,90,97-101"}
401402
```python
402-
from bigtree import Node, print_tree
403+
from bigtree import Node, print_tree, hprint_tree
403404

404405
root = Node("a", age=90, gender="F")
405406
b = Node("b", age=65, gender="M", parent=root)
@@ -413,6 +414,12 @@ print_tree(root)
413414
# │ └── e
414415
# └── c
415416

417+
hprint_tree(root)
418+
# ┌─ d
419+
# ┌─ b ─┤
420+
# ─ a ─┤ └─ e
421+
# └─ c
422+
416423
# Print subtree
417424
print_tree(root, node_name_or_path="b")
418425
# b
@@ -536,6 +543,7 @@ Below are the tables of attributes available to `BaseNode` and `Node` classes.
536543
| Check if leaf node | `root.is_leaf` | False |
537544
| Check depth of node | `node_b.depth` | 2 |
538545
| Check depth of tree | `node_b.max_depth` | 4 |
546+
| Get root of tree | `node_b.root` | Node(/a, ) |
539547
| Get node path | `node_b.node_path` | (Node(/a, ), Node(/a/b, )) |
540548
| Get node name (only for `Node`) | `node_b.node_name` | 'b' |
541549
| Get node path name (only for `Node`) | `node_b.path_name` | '/a/b' |
@@ -553,14 +561,18 @@ Below are the tables of attributes available to `BaseNode` and `Node` classes.
553561

554562
Below is the table of operations available to `BaseNode` and `Node` classes.
555563

556-
| Operations | Code | Returns |
557-
|------------------------------------|------------------------------------------------------------|--------------------------------------------|
558-
| Get node information | `root.describe(exclude_prefix="_")` | [('name', 'a')] |
559-
| Find path from one node to another | `root.go_to(node_e)` | [Node(/a, ), Node(/a/b, ), Node(/a/b/e, )] |
560-
| Set attribute(s) | `root.set_attrs({"description": "root-tag"})` | None |
561-
| Get attribute | `root.get_attr("description")` | 'root-tag' |
562-
| Copy tree | `root.copy()` | None |
563-
| Sort children | `root.sort(key=lambda node: node.node_name, reverse=True)` | None |
564+
| Operations | Code | Returns |
565+
|-------------------------------------------------|------------------------------------------------------------|--------------------------------------------|
566+
| Visualize tree (only for `Node`) | `root.show()` | None |
567+
| Visualize tree (horizontally) (only for `Node`) | `root.hshow()` | None |
568+
| Get node information | `root.describe(exclude_prefix="_")` | [('name', 'a')] |
569+
| Find path from one node to another | `root.go_to(node_e)` | [Node(/a, ), Node(/a/b, ), Node(/a/b/e, )] |
570+
| Add child to node | `root.append(Node("j"))` | None |
571+
| Add multiple children to node | `root.extend([Node("k"), Node("l")])` | None |
572+
| Set attribute(s) | `root.set_attrs({"description": "root-tag"})` | None |
573+
| Get attribute | `root.get_attr("description")` | 'root-tag' |
574+
| Copy tree | `root.copy()` | None |
575+
| Sort children | `root.sort(key=lambda node: node.node_name, reverse=True)` | None |
564576

565577
### Traverse Tree
566578

docs/source/_static/custom.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ header {
2121
h1, h2, h3, h4, p, a {
2222
font-family: Nobile, sans-serif !important;
2323
}
24+
pre {
25+
font-family: monospace;
26+
}
2427
p {
2528
margin-bottom: 2rem;
2629
}

0 commit comments

Comments
 (0)