g6/packages/site/docs/apis/data/TreeData.en.md
Aaron 3534d4669b
docs: adjust docs of data (#5211)
* docs: adjust docs of data

* docs: update api docs
2023-12-01 17:44:49 +08:00

53 lines
1.0 KiB
Markdown

---
title: TreeData
order: 2
---
A tree is a special graph, that is, a graph without a cycle. Tree data (TreeData) does not explicitly define edges, but implicitly represents edges through nested `children`, that is, there is an edge between parent and child nodes.
An example of a tree data is as follows:
```json
{
"id": "root",
"data": {},
"children": [
{
"id": "node-1",
"data": {},
"children": [
{
"id": "node-1-1",
"data": {},
"children": [
{
"id": "node-1-1-1",
"data": {},
"children": []
}
]
}
]
}
]
}
```
G6 5.0 can read `TreeData`, `TreeData[]`, that is, **tree** and **forest**.
## Properties
<embed src="../../common/DataID.en.md"></embed>
### data <Badge type="error">Required</Badge>
**Type**: [NodeUserModelData](./NodeUserModelData.en.md);
The data of the node
### children
**Type**: `TreeData`
The array of child nodes of the current node