@@ -17,17 +17,18 @@ Construct Tree from list, dictionary, and pandas/polars DataFrame.
1717To decide which method to use, consider your data type and data values. Construction methods are implemented as class
1818methods.
1919
20- | Construct tree from | Using full path | Using parent-child relation | Using notation | Add node attributes |
21- | ---------------------| -----------------------| ------------------------------------------------------| --------------------| ----------------------------------------------------------|
22- | String | ` Tree.from_str ` | NA | ` Tree.from_newick ` | No (for ` Tree.from_str ` )<br >Yes (for ` Tree.from_newick ` ) |
23- | List | ` Tree.from_list ` | ` Tree.from_list_relation ` | NA | No |
24- | Dictionary | ` Tree.from_dict ` | ` Tree.from_nested_dict ` , ` Tree.from_nested_dict_key ` | NA | Yes |
25- | pandas DataFrame | ` Tree.from_dataframe ` | ` Tree.from_dataframe_relation ` | NA | Yes |
26- | polars DataFrame | ` Tree.from_polars ` | ` Tree.from_polars_relation ` | NA | Yes |
27-
28- | Construct tree from | Notation | Add node attributes |
29- | ---------------------| ---------------------| -----------------------|
30- | rich Tree | ` Tree.from_rich ` | Only style attributes |
20+ | Construct tree from | Using full path | Using parent-child relation | Add node attributes |
21+ | ---------------------| -----------------------| ------------------------------------------------------| ---------------------|
22+ | List | ` Tree.from_list ` | ` Tree.from_list_relation ` | No |
23+ | Dictionary | ` Tree.from_dict ` | ` Tree.from_nested_dict ` , ` Tree.from_nested_dict_key ` | Yes |
24+ | pandas DataFrame | ` Tree.from_dataframe ` | ` Tree.from_dataframe_relation ` | Yes |
25+ | polars DataFrame | ` Tree.from_polars ` | ` Tree.from_polars_relation ` | Yes |
26+
27+ | Construct tree from | Notation | Add node attributes |
28+ | ---------------------| --------------------| -----------------------|
29+ | String | ` Tree.from_str ` | No |
30+ | Newick string | ` Tree.from_newick ` | Yes |
31+ | rich Tree | ` Tree.from_rich ` | Only style attributes |
3132
3233To add attributes to an existing tree,
3334
@@ -58,16 +59,25 @@ Export Tree to list, dictionary, pandas/polars DataFrame, and various formats.
5859| Mermaid Markdown (for .md) | ` to_mermaid ` |
5960| Visualization | ` to_vis ` |
6061
61- ## Tree Helper Methods
62+ ## Tree Iterator Methods
6263
63- Helper functions that can come in handy. Helper methods will return a separate Tree -type object.
64+ Iterator methods will return Node -type object(s) .
6465
65- | Description | Method |
66- | ---------------| --------------------------|
67- | Clone tree | ` clone ` |
68- | Get subtree | ` subtree ` |
69- | Prune tree | ` prune ` |
70- | Compare trees | ` diff_dataframe ` , ` diff ` |
66+ | Data Structure | Algorithm | Description |
67+ | ----------------| -------------------------------------------| -------------------------|
68+ | Tree | ` preorder_iter ` | Depth-First Search, NLR |
69+ | Tree | ` postorder_iter ` | Depth-First Search, LRN |
70+ | Tree | ` levelorder_iter ` , ` levelordergroup_iter ` | Breadth-First Search |
71+ | Tree | ` zigzag_iter ` , ` zigzaggroup_iter ` | Breadth-First Search |
72+
73+ ## Tree Modify Methods
74+
75+ Modification functions can shift and/or copy nodes within the same tree.
76+
77+ | Description | Method |
78+ | ---------------| -------------------------------------------|
79+ | Shift node(s) | ` shift_nodes ` / ` shift_and_replace_nodes ` |
80+ | Copy node(s) | ` copy_nodes ` |
7181
7282## Tree Query and Search Methods
7383
@@ -81,16 +91,16 @@ Query and search to find nodes. These methods will return Node-type object(s).
8191| Node path | ` find_path ` , ` find_full_path ` , ` find_relative_path ` | ` find_paths ` , ` find_relative_paths ` |
8292| Node attributes | ` find_attr ` | ` find_attrs ` |
8393
84- ## Iterator Methods
94+ ## Tree Helper Methods
8595
86- Iterator methods will return Node -type object(s) .
96+ Helper functions that can come in handy. Helper methods will return a separate Tree -type object.
8797
88- | Data Structure | Algorithm | Description |
89- | ---------------- | ------------------------------------------- | -------------------------|
90- | Tree | ` preorder_iter ` | Depth-First Search, NLR |
91- | Tree | ` postorder_iter ` | Depth-First Search, LRN |
92- | Tree | ` levelorder_iter ` , ` levelordergroup_iter ` | Breadth-First Search |
93- | Tree | ` zigzag_iter ` , ` zigzaggroup_iter ` | Breadth-First Search |
98+ | Description | Method |
99+ | ---------------| - -------------------------|
100+ | Clone tree | ` clone ` |
101+ | Get subtree | ` subtree ` |
102+ | Prune tree | ` prune ` |
103+ | Compare trees | ` diff_dataframe ` , ` diff ` |
94104
95105-----
96106::: bigtree.tree.tree
0 commit comments