Skip to content

Commit 26810ad

Browse files
author
Zachary Marion
committed
Update README
1 parent d6933f9 commit 26810ad

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,26 @@
22

33
![React svg tree](https://raw.githubusercontent.com/zacharyfmarion/react-svg-tree/master/assets/tree.png)
44

5-
React Tree provides components for rendering tree graphs with svg. It uses the algorithm described in [this paper](http://www.cs.unc.edu/techreports/89-034.pdf). You can pass in a map of the vertices to their children:
5+
React Tree provides components for rendering tree graphs with svg. It uses the algorithm described in [this paper](http://www.cs.unc.edu/techreports/89-034.pdf). You can pass in a map of the vertices to render the tree:
66

77
```js
88
import { Tree, Node } from 'react-svg-tree';
99

10+
const vertexMap = new Map([
11+
[0, [1, 2, 3]],
12+
[1, [4, 5]],
13+
[2, []],
14+
[3, [6]],
15+
[4, []],
16+
[5, []],
17+
[6, []],
18+
]);
19+
1020
const App = () => (
1121
<Tree
1222
width={200}
1323
height={150}
14-
rootId="O"
24+
rootId={0}
1525
vertices={vertexMap}
1626
showLabels={true}
1727
/>

0 commit comments

Comments
 (0)