Skip to content

Commit

Permalink
feat: add edge weight documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ducttrn committed Apr 14, 2022
1 parent a38a3b4 commit 14c8e2f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ tree = BinaryTree(nodes=[5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1])
tree.plot(orientation='LR', border_color='#FFCE30', fill_color='#aec6cf')
```
![colored](https://github.com/billtrn/dsplot/blob/master/img/color_tree.png?raw=true)

- Edge values for Graphs: <br>
For edge values, `str` and `int` data types are supported at the moment.
```python
from dsplot.graph import Graph

graph = Graph(
{0: [1, 4, 5], 1: [3, 4], 2: [1], 3: [2, 4], 4: [], 5: []},
directed=True,
edges={'01': 1, '04': 4, '05': 5, '13': 3, '14': 4, '21': 2, '32': 3, '34': 4},
)
graph.plot()
```
![edge](https://github.com/billtrn/dsplot/blob/master/img/edge_graph.png?raw=true)
## 🎁 Additional features
### 1. Tree traversals:
```python
Expand Down
Binary file added img/edge_graph.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ skip-string-normalization = true

[tool.poetry]
name = "dsplot"
version = "0.7.0"
version = "0.8.0"
description = "Visualize Tree, Graph, and Matrix data structures with ease."
authors = ["Bill <trantriducs@gmail.com>"]
license = "MIT"
Expand Down

0 comments on commit 14c8e2f

Please sign in to comment.