Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Marion committed Aug 8, 2018
1 parent d6933f9 commit 26810ad
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@

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

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:
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:

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

const vertexMap = new Map([
[0, [1, 2, 3]],
[1, [4, 5]],
[2, []],
[3, [6]],
[4, []],
[5, []],
[6, []],
]);

const App = () => (
<Tree
width={200}
height={150}
rootId="O"
rootId={0}
vertices={vertexMap}
showLabels={true}
/>
Expand Down

0 comments on commit 26810ad

Please sign in to comment.