From 9d5c6d5d1dcca28c9783fed5bd770f56fe8fe2d4 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Mon, 1 Dec 2014 09:16:27 +0100 Subject: [PATCH] Update README.md --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index fa0dd312c..1b86bd99a 100644 --- a/README.md +++ b/README.md @@ -251,5 +251,27 @@ click nodeId callback * nodeId is the id of the node * callback is the name of a javascript function defined on the page displaying the graph, the function will be called with the nodeId as parameter. +## Usage of the parser as a seperate module + +### Setup +``` +var graph = require('./graphDb'); +var flow = require('./parser/flow'); +flow.parser.yy = graph; +``` + +### Parsing + +``` +flow.parser.parse(text); +``` + +### Data extraction +``` +graph.getDirection(); +graph.getVertices(); +graph.getEdges(); +``` + # Credits Many thanks to the [d3](http://d3js.org/) and [dagre-d3](https://github.com/cpettitt/dagre-d3) projects for providing the graphical layout and drawing libraries!