Full Code of glejeune/node-graphviz for AI

master f552e1fd2c36 cached
32 files
70.1 KB
23.9k tokens
5 symbols
1 requests
Download .txt
Repository: glejeune/node-graphviz
Branch: master
Commit: f552e1fd2c36
Files: 32
Total size: 70.1 KB

Directory structure:
gitextract_83we1a8e/

├── .all-contributorsrc
├── .eslintignore
├── .eslintrc.json
├── .gitignore
├── .prettierrc
├── CHANGELOG.md
├── Jakefile.js
├── LICENCE.txt
├── README.md
├── lib/
│   ├── deps/
│   │   ├── attributs.js
│   │   ├── core_ext/
│   │   │   ├── fs-ext.js
│   │   │   └── hash.js
│   │   ├── edge.js
│   │   ├── graph.js
│   │   └── node.js
│   ├── ext/
│   │   └── gvpr/
│   │       └── dot2js.g
│   └── graphviz.js
├── package.json
└── tests/
    ├── cluster.dot
    ├── cluster.js
    ├── compound.js
    ├── fdpclust.js
    ├── hello.js
    ├── hello_world.js
    ├── memory.js
    ├── parse.js
    ├── remove_node.js
    ├── server/
    │   ├── app.js
    │   ├── static/
    │   │   └── dotgraph.js
    │   └── views/
    │       ├── index.ejs
    │       └── layout.ejs
    └── switch.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .all-contributorsrc
================================================
{
  "projectName": "node-graphviz",
  "projectOwner": "glejeune",
  "repoType": "github",
  "repoHost": "https://github.com",
  "files": [
    "README.md"
  ],
  "imageSize": 100,
  "commit": false,
  "contributors": [
    {
      "login": "glejeune",
      "name": "Gregoire Lejeune",
      "avatar_url": "https://avatars1.githubusercontent.com/u/15168?v=4",
      "profile": "http://lejeun.es",
      "contributions": [
        "code",
        "doc",
        "example"
      ]
    },
    {
      "login": "dariusk",
      "name": "Darius Kazemi",
      "avatar_url": "https://avatars3.githubusercontent.com/u/266454?v=4",
      "profile": "https://tinysubversions.com",
      "contributions": [
        "code"
      ]
    },
    {
      "login": "SebastienElet",
      "name": "Sébastien ELET",
      "avatar_url": "https://avatars0.githubusercontent.com/u/541937?v=4",
      "profile": "https://github.com/SebastienElet",
      "contributions": [
        "code"
      ]
    },
    {
      "login": "papandreou",
      "name": "Andreas Lind",
      "avatar_url": "https://avatars3.githubusercontent.com/u/373545?v=4",
      "profile": "https://github.com/papandreou",
      "contributions": [
        "code"
      ]
    },
    {
      "login": "blakmatrix",
      "name": "Farrin Reid",
      "avatar_url": "https://avatars3.githubusercontent.com/u/91209?v=4",
      "profile": "http://www.blakmatrix.com",
      "contributions": [
        "code"
      ]
    },
    {
      "login": "pahen",
      "name": "Patrik Henningsson",
      "avatar_url": "https://avatars3.githubusercontent.com/u/353888?v=4",
      "profile": "https://pahen.se",
      "contributions": [
        "code"
      ]
    },
    {
      "login": "pooriaazimi",
      "name": "Pooria Azimi",
      "avatar_url": "https://avatars2.githubusercontent.com/u/814637?v=4",
      "profile": "https://github.com/pooriaazimi",
      "contributions": [
        "code"
      ]
    },
    {
      "login": "BridgeAR",
      "name": "Ruben Bridgewater",
      "avatar_url": "https://avatars2.githubusercontent.com/u/8822573?v=4",
      "profile": "https://twitter.com/BridgeAR",
      "contributions": [
        "code"
      ]
    },
    {
      "login": "mathieuravaux",
      "name": "Mathieu Ravaux",
      "avatar_url": "https://avatars1.githubusercontent.com/u/38495?v=4",
      "profile": "https://github.com/mathieuravaux",
      "contributions": [
        "code"
      ]
    }
  ],
  "contributorsPerLine": 7
}


================================================
FILE: .eslintignore
================================================
test/data


================================================
FILE: .eslintrc.json
================================================
{
  "root": true,
  "extends": ["airbnb-base", "prettier", "plugin:promise/recommended", "plugin:node/recommended"],
  "env": {
    "node": true
  },
  "plugins": ["promise"],
  "rules": {
    "global-require": "off",
    "vars-on-top": "off",
    "dot-notation": "off",
    "guard-for-in": "off",
    "func-names": "off",
    "one-var": "off",
    "no-underscore-dangle": "off",
    "no-plusplus": "off",
    "no-process-exit": "off",
    "no-bitwise": "off",
    "no-extend-native": "off",
    "handle-callback-err": ["error", "^(err|error)$"],
    "camelcase": ["error", { "properties": "never" }],
    "no-use-before-define": ["error", "nofunc"],
    "no-mixed-requires": ["warn", { "grouping": true }],
    "id-length": ["warn", { "min": 2, "exceptions": ["i", "_"] }],
    "no-unused-expressions": ["error", { "allowShortCircuit": true }],
    "no-param-reassign": ["warn"],
    "no-unused-vars": ["error", { "varsIgnorePattern": "^_.+", "argsIgnorePattern": "^_" }]
  },
  "parserOptions": {
    "ecmaVersion": 2018
  }
}


================================================
FILE: .gitignore
================================================
.DS_Store
doc
pkg
test/output/
documentation.html
node_modules/
test/*.png


================================================
FILE: .prettierrc
================================================
{
  "singleQuote": true,
  "trailingComma": "es5",
  "printWidth": 120,
  "semi": true
}


================================================
FILE: CHANGELOG.md
================================================
# Change Log

## [0.0.9](https://github.com/glejeune/node-graphviz/tree/0.0.9) (2019-04-03)
[Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.8...0.0.9)

**Closed issues:**

- Is it possible to create a stripped down version for browsers that only generates dot code? [\#15](https://github.com/glejeune/node-graphviz/issues/15)
- Is there a way to tell this library to ignore duplicate edges? [\#13](https://github.com/glejeune/node-graphviz/issues/13)
- How to get x,y coords for a node? [\#11](https://github.com/glejeune/node-graphviz/issues/11)

**Merged pull requests:**

- Fix missing error handling [\#26](https://github.com/glejeune/node-graphviz/pull/26) ([BridgeAR](https://github.com/BridgeAR))
- Fixing `for in` loops [\#17](https://github.com/glejeune/node-graphviz/pull/17) ([dariusk](https://github.com/dariusk))
- Node setter is now fluent. [\#16](https://github.com/glejeune/node-graphviz/pull/16) ([SebastienElet](https://github.com/SebastienElet))

## [0.0.8](https://github.com/glejeune/node-graphviz/tree/0.0.8) (2012-08-04)
[Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.7...0.0.8)

**Closed issues:**

- Clickable Nodes [\#10](https://github.com/glejeune/node-graphviz/issues/10)

**Merged pull requests:**

- `npm install node-graphviz` --\> `npm install graphviz` [\#9](https://github.com/glejeune/node-graphviz/pull/9) ([pooriaazimi](https://github.com/pooriaazimi))

## [0.0.7](https://github.com/glejeune/node-graphviz/tree/0.0.7) (2012-07-01)
[Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.6...0.0.7)

**Closed issues:**

- Publish 0.0.6 with correct dependency on 'temp' to the npm repo? [\#5](https://github.com/glejeune/node-graphviz/issues/5)

**Merged pull requests:**

- Fixed so it can be installed on v0.8. Please bump version & update the NPM repo :\) [\#7](https://github.com/glejeune/node-graphviz/pull/7) ([pahen](https://github.com/pahen))
- Hi! I fixed some calls to "sys" for you! [\#6](https://github.com/glejeune/node-graphviz/pull/6) ([node-migrator-bot](https://github.com/node-migrator-bot))

## [0.0.6](https://github.com/glejeune/node-graphviz/tree/0.0.6) (2012-01-27)
[Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.5...0.0.6)

**Closed issues:**

- Error: EPIPE, Broken pipe [\#3](https://github.com/glejeune/node-graphviz/issues/3)
- Graph.prototype.getNodeAttribut [\#2](https://github.com/glejeune/node-graphviz/issues/2)

## [0.0.5](https://github.com/glejeune/node-graphviz/tree/0.0.5) (2011-12-14)
[Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.4...0.0.5)

**Merged pull requests:**

- graphviz.js: Don't require the 'sys' module. [\#4](https://github.com/glejeune/node-graphviz/pull/4) ([papandreou](https://github.com/papandreou))

## [0.0.4](https://github.com/glejeune/node-graphviz/tree/0.0.4) (2010-11-16)
[Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.3...0.0.4)

## [0.0.3](https://github.com/glejeune/node-graphviz/tree/0.0.3) (2010-10-04)
[Full Changelog](https://github.com/glejeune/node-graphviz/compare/0.0.2...0.0.3)

## [0.0.2](https://github.com/glejeune/node-graphviz/tree/0.0.2) (2010-09-29)


\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

================================================
FILE: Jakefile.js
================================================
// This file is a node-jake file -- http://github.com/mde/node-jake

var util = require('util'),
	exec  = require('child_process').exec,
	child;

var docTitle = 'node-graphviz'
var docFiles = 'lib/graphviz.js lib/deps/graph.js lib/deps/node.js lib/deps/edge.js'
var outputDocFile = 'documentation.json'
var docRibbon = 'http://github.com/glejeune/node-graphviz'
var docDesc = '[Node.js](http://nodejs.org) interface to the [GraphViz](http://graphviz.org) graphing tool'

desc('Generate node-graphviz documentation.');
task('doc', [], function () {
  child = exec('dox -r ' + docRibbon + ' -d "' + docDesc + '" -t "' + docTitle + '" < ' + docFiles + ' > ' + outputDocFile, 
    function (error, stdout, stderr) {
      if (error !== null) {
        console.log('exec error: ' + error);
      }
  });
});

desc('Install');
task('install', [], function() {
	child = exec('npm install .',
		function(error, stdout, stderr) {
			if (error !== null) {
				console.log('exec error: ' + error);
			}
		}
	);
});

desc('Publish');
task('publish', [], function() {
	child = exec('npm publish .',
		function(error, stdout, stderr) {
			if (error !== null) {
				console.log('exec error: ' + error);
			}
		}
	);
});


================================================
FILE: LICENCE.txt
================================================
Copyright (c) 2010 Gregoire Lejeune <gregoire.lejeune@free.fr>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


================================================
FILE: README.md
================================================
# Node.js GraphViz Module

[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors)

Copyright (C) 2010-2019 Gregoire Lejeune

* Sources : http://github.com/glejeune/node-graphviz

## DESCRIPTION

Interface to the GraphViz graphing tool

## SYNOPSIS

A basic example

```javascript
var util = require('util'),
    graphviz = require('graphviz');

// Create digraph G
var g = graphviz.digraph("G");

// Add node (ID: Hello)
var n1 = g.addNode( "Hello", {"color" : "blue"} );
n1.set( "style", "filled" );

// Add node (ID: World)
g.addNode( "World" );

// Add edge between the two nodes
var e = g.addEdge( n1, "World" );
e.set( "color", "red" );

// Print the dot script
console.log( g.to_dot() );

// Set GraphViz path (if not in your path)
g.setGraphVizPath( "/usr/local/bin" );
// Generate a PNG output
g.output( "png", "test01.png" );
```

## INSTALLATION

```
$ npm install graphviz
```

You also need to install [GraphViz](http://www.graphviz.org)

## DOCUMENTATION

To build the documentation:

```bash
npm install -g jake dox
jake doc & open documentation.json
```

## AUTHORS

* Gregoire Lejeune (http://algorithmique.net)
* Mathieu Ravaux (http://mathieuravaux.com)

## LICENCES

Copyright (c) 2010 Gregoire Lejeune <gregoire.lejeune@free.fr>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


## Contributors

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<table><tr><td align="center"><a href="http://lejeun.es"><img src="https://avatars1.githubusercontent.com/u/15168?v=4" width="100px;" alt="Gregoire Lejeune"/><br /><sub><b>Gregoire Lejeune</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=glejeune" title="Code">💻</a> <a href="https://github.com/glejeune/node-graphviz/commits?author=glejeune" title="Documentation">📖</a> <a href="#example-glejeune" title="Examples">💡</a></td><td align="center"><a href="https://tinysubversions.com"><img src="https://avatars3.githubusercontent.com/u/266454?v=4" width="100px;" alt="Darius Kazemi"/><br /><sub><b>Darius Kazemi</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=dariusk" title="Code">💻</a></td><td align="center"><a href="https://github.com/SebastienElet"><img src="https://avatars0.githubusercontent.com/u/541937?v=4" width="100px;" alt="Sébastien ELET"/><br /><sub><b>Sébastien ELET</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=SebastienElet" title="Code">💻</a></td><td align="center"><a href="https://github.com/papandreou"><img src="https://avatars3.githubusercontent.com/u/373545?v=4" width="100px;" alt="Andreas Lind"/><br /><sub><b>Andreas Lind</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=papandreou" title="Code">💻</a></td><td align="center"><a href="http://www.blakmatrix.com"><img src="https://avatars3.githubusercontent.com/u/91209?v=4" width="100px;" alt="Farrin Reid"/><br /><sub><b>Farrin Reid</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=blakmatrix" title="Code">💻</a></td><td align="center"><a href="https://pahen.se"><img src="https://avatars3.githubusercontent.com/u/353888?v=4" width="100px;" alt="Patrik Henningsson"/><br /><sub><b>Patrik Henningsson</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=pahen" title="Code">💻</a></td><td align="center"><a href="https://github.com/pooriaazimi"><img src="https://avatars2.githubusercontent.com/u/814637?v=4" width="100px;" alt="Pooria Azimi"/><br /><sub><b>Pooria Azimi</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=pooriaazimi" title="Code">💻</a></td></tr><tr><td align="center"><a href="https://twitter.com/BridgeAR"><img src="https://avatars2.githubusercontent.com/u/8822573?v=4" width="100px;" alt="Ruben Bridgewater"/><br /><sub><b>Ruben Bridgewater</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=BridgeAR" title="Code">💻</a></td><td align="center"><a href="https://github.com/mathieuravaux"><img src="https://avatars1.githubusercontent.com/u/38495?v=4" width="100px;" alt="Mathieu Ravaux"/><br /><sub><b>Mathieu Ravaux</b></sub></a><br /><a href="https://github.com/glejeune/node-graphviz/commits?author=mathieuravaux" title="Code">💻</a></td></tr></table>

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!


================================================
FILE: lib/deps/attributs.js
================================================
var Hash = require('./core_ext/hash').Hash,
  util = require('util');

var attrs = {
  Damping: { usage: 'G', type: 'double' },
  K: { usage: 'GC', type: 'double' },
  URL: { usage: 'ENGC', type: 'escString' },
  area: { usage: 'NC', type: 'double' },
  arrowhead: { usage: 'E', type: 'arrowType' },
  arrowsize: { usage: 'E', type: 'double' },
  arrowtail: { usage: 'E', type: 'arrowType' },
  aspect: { usage: 'G', type: 'aspectType' },
  bb: { usage: 'G', type: 'rect' },
  bgcolor: { usage: 'GC', type: 'color' },
  center: { usage: 'G', type: 'bool' },
  charset: { usage: 'G', type: 'string' },
  clusterrank: { usage: 'G', type: 'clusterMode' },
  color: { usage: 'ENC', type: 'color' },
  colorscheme: { usage: 'ENCG', type: 'string' },
  comment: { usage: 'ENG', type: 'string' },
  compound: { usage: 'G', type: 'bool' },
  concentrate: { usage: 'G', type: 'bool' },
  constraint: { usage: 'E', type: 'bool' },
  decorate: { usage: 'E', type: 'bool' },
  defaultdist: { usage: 'G', type: 'double' },
  dim: { usage: 'G', type: 'int' },
  dimen: { usage: 'G', type: 'int' },
  dir: { usage: 'E', type: 'dirType' },
  diredgeconstraints: { usage: 'G', type: 'string' },
  distortion: { usage: 'N', type: 'double' },
  dpi: { usage: 'G', type: 'double' },
  edgeURL: { usage: 'E', type: 'escString' },
  edgehref: { usage: 'E', type: 'escString' },
  edgetarget: { usage: 'E', type: 'escString' },
  edgetooltip: { usage: 'E', type: 'escString' },
  epsilon: { usage: 'G', type: 'double' },
  esep: { usage: 'G', type: 'double' },
  fillcolor: { usage: 'NEC', type: 'color' },
  fixedsize: { usage: 'N', type: 'bool' },
  fontcolor: { usage: 'ENGC', type: 'color' },
  fontname: { usage: 'ENGC', type: 'string' },
  fontnames: { usage: 'G', type: 'string' },
  fontpath: { usage: 'G', type: 'string' },
  fontsize: { usage: 'ENGC', type: 'double' },
  group: { usage: 'N', type: 'string' },
  headURL: { usage: 'E', type: 'escString' },
  headclip: { usage: 'E', type: 'bool' },
  headhref: { usage: 'E', type: 'escString' },
  headlabel: { usage: 'E', type: 'lblString' },
  headport: { usage: 'E', type: 'portPos' },
  headtarget: { usage: 'E', type: 'escString' },
  headtooltip: { usage: 'E', type: 'escString' },
  height: { usage: 'N', type: 'double' },
  href: { usage: 'ENGC', type: 'escString' },
  id: { usage: 'GNE', type: 'lblString' },
  image: { usage: 'N', type: 'string' },
  imagepath: { usage: 'G', type: 'string' },
  imagescale: { usage: 'N', type: 'string' },
  label: { usage: 'ENGC', type: 'lblString' },
  labelURL: { usage: 'E', type: 'escString' },
  labelangle: { usage: 'E', type: 'double' },
  labeldistance: { usage: 'E', type: 'double' },
  labelfloat: { usage: 'E', type: 'bool' },
  labelfontcolor: { usage: 'E', type: 'color' },
  labelfontname: { usage: 'E', type: 'string' },
  labelfontsize: { usage: 'E', type: 'double' },
  labelhref: { usage: 'E', type: 'escString' },
  labeljust: { usage: 'GC', type: 'string' },
  labelloc: { usage: 'NGC', type: 'string' },
  labeltarget: { usage: 'E', type: 'escString' },
  labeltooltip: { usage: 'E', type: 'escString' },
  landscape: { usage: 'G', type: 'bool' },
  layer: { usage: 'ENC', type: 'layerRange' },
  layerlistsep: { usage: 'G', type: 'string' },
  layers: { usage: 'G', type: 'layerList' },
  layerselect: { usage: 'G', type: 'layerRange' },
  layersep: { usage: 'G', type: 'string' },
  layout: { usage: 'G', type: 'string' },
  len: { usage: 'E', type: 'double' },
  levels: { usage: 'G', type: 'int' },
  levelsgap: { usage: 'G', type: 'double' },
  lhead: { usage: 'E', type: 'string' },
  lheight: { usage: 'GC', type: 'double' },
  lp: { usage: 'EGC', type: 'point' },
  ltail: { usage: 'E', type: 'string' },
  lwidth: { usage: 'GC', type: 'double' },
  margin: { usage: 'NGC', type: 'pointf' },
  maxiter: { usage: 'G', type: 'int' },
  mclimit: { usage: 'G', type: 'double' },
  mindist: { usage: 'G', type: 'double' },
  minlen: { usage: 'E', type: 'int' },
  mode: { usage: 'G', type: 'string' },
  model: { usage: 'G', type: 'string' },
  mosek: { usage: 'G', type: 'bool' },
  nodesep: { usage: 'G', type: 'double' },
  nojustify: { usage: 'GCNE', type: 'bool' },
  normalize: { usage: 'G', type: 'bool' },
  nslimit: { usage: 'G', type: 'double' },
  nslimit1: { usage: 'G', type: 'double' },
  ordering: { usage: 'GN', type: 'string' },
  orientation: { usage: 'GN', type: 'string' },
  outputorder: { usage: 'G', type: 'outputMode' },
  overlap: { usage: 'G', type: 'string' },
  overlap_scaling: { usage: 'G', type: 'double' },
  pack: { usage: 'G', type: 'int' },
  packmode: { usage: 'G', type: 'packMode' },
  pad: { usage: 'G', type: 'pointf' },
  page: { usage: 'G', type: 'pointf' },
  pagedir: { usage: 'G', type: 'pagedir' },
  pencolor: { usage: 'C', type: 'color' },
  penwidth: { usage: 'CNE', type: 'double' },
  peripheries: { usage: 'NC', type: 'int' },
  pin: { usage: 'N', type: 'bool' },
  pos: { usage: 'EN', type: 'point' },
  quadtree: { usage: 'G', type: 'quadType' },
  quantum: { usage: 'G', type: 'double' },
  rank: { usage: 'S', type: 'rankType' },
  rankdir: { usage: 'G', type: 'rankdir' },
  ranksep: { usage: 'G', type: 'double' },
  ratio: { usage: 'G', type: 'string' },
  rects: { usage: 'N', type: 'rect' },
  regular: { usage: 'N', type: 'bool' },
  remincross: { usage: 'G', type: 'bool' },
  repulsiveforce: { usage: 'G', type: 'double' },
  resolution: { usage: 'G', type: 'double' },
  root: { usage: 'GN', type: 'string' },
  rotate: { usage: 'G', type: 'int' },
  rotation: { usage: 'G', type: 'double' },
  samehead: { usage: 'E', type: 'string' },
  sametail: { usage: 'E', type: 'string' },
  samplepoints: { usage: 'N', type: 'int' },
  scale: { usage: 'G', type: 'double' },
  searchsize: { usage: 'G', type: 'int' },
  sep: { usage: 'G', type: 'double' },
  shape: { usage: 'N', type: 'shape' },
  shapefile: { usage: 'N', type: 'string' },
  showboxes: { usage: 'ENG', type: 'int' },
  sides: { usage: 'N', type: 'int' },
  size: { usage: 'G', type: 'pointf' },
  skew: { usage: 'N', type: 'double' },
  smoothing: { usage: 'G', type: 'smoothType' },
  sortv: { usage: 'GCN', type: 'int' },
  splines: { usage: 'G', type: 'string' },
  start: { usage: 'G', type: 'startType' },
  style: { usage: 'ENCG', type: 'style' },
  stylesheet: { usage: 'G', type: 'string' },
  tail_lp: { usage: 'E', type: 'pointf' },
  tailURL: { usage: 'E', type: 'escString' },
  tailclip: { usage: 'E', type: 'bool' },
  tailhref: { usage: 'E', type: 'escString' },
  taillabel: { usage: 'E', type: 'lblString' },
  tailport: { usage: 'E', type: 'portPos' },
  tailtarget: { usage: 'E', type: 'escString' },
  tailtooltip: { usage: 'E', type: 'escString' },
  target: { usage: 'ENGC', type: 'escString' },
  tooltip: { usage: 'NEC', type: 'escString' },
  truecolor: { usage: 'G', type: 'bool' },
  vertices: { usage: 'N', type: 'pointfList' },
  viewport: { usage: 'G', type: 'viewPort' },
  voro_margin: { usage: 'G', type: 'double' },
  weight: { usage: 'E', type: 'double' },
  width: { usage: 'N', type: 'double' },
  xlabel: { usage: 'EN', type: 'lblString' },
  z: { usage: 'N', type: 'double' },
};

var gType = {
  E: 'edge',
  N: 'node',
  G: 'graph',
  C: 'cluster',
};

var quotedTypes = [
  'escString',
  'rect',
  'color',
  'colorList',
  'string',
  'lblString',
  'portPos',
  'point',
  'pointf',
  'pointfList',
  'splineType',
  'style',
  'viewPort',
];

function mustBeQuoted(data) {
  return quotedTypes.indexOf(attrs[data].type) !== -1;
}

function quoteMe(attr, value) {
  if (value[0] === '!') {
    return '<' + value.substr(1, 1000) + '>';
  } else if (mustBeQuoted(attr)) {
    return ' "' + value + '"';
  } else {
    return value;
  }
}

function validateAttribut(name, type) {
  if (attrs[name]) {
    return attrs[name].usage.indexOf(type) > -1;
  } else {
    return false;
  }
}

exports.isValid = function(name, type) {
  return validateAttribut(name, type);
};

var Attributs = (exports.Attributs = function(t) {
  this._type = t;
  this.attributs = new Hash();
});

Attributs.prototype.length = function() {
  return this.attributs.length;
};

Attributs.prototype.set = function(name, value) {
  if (validateAttribut(name, this._type) === false) {
    console.error('Warning : Invalid attribut `' + name + "' for a " + gType[this._type]);
    // throw "Invalid attribut `"+name+"' for a "+gType[this._type]
  }
  this.attributs.setItem(name, value);
};

Attributs.prototype.get = function(name) {
  return this.attributs.items[name];
};

Attributs.prototype.to_dot = function(link) {
  var attrsOutput = '',
    sep = '';

  if (this.attributs.length > 0) {
    attrsOutput = attrsOutput + ' [ ';
    for (var name in this.attributs.items) {
      if (this.attributs.items.hasOwnProperty(name)) {
        attrsOutput = attrsOutput + sep + name + ' =' + quoteMe(name, this.attributs.items[name]);
        sep = ', ';
      }
    }
    attrsOutput = attrsOutput + ' ]';
  }

  return attrsOutput;
};


================================================
FILE: lib/deps/core_ext/fs-ext.js
================================================
var fs = require('fs');

exports.exist = function(path) {
  try {
    fs.statSync(path);
  } catch (e) {
    return false;
  }
  return true;
};


================================================
FILE: lib/deps/core_ext/hash.js
================================================
var Hash = (exports.Hash = function() {
  this.length = 0;
  this.items = new Array();
  for (var i = 0; i < arguments.length; i += 2) {
    if (typeof arguments[i + 1] != 'undefined') {
      this.items[arguments[i]] = arguments[i + 1];
      this.length++;
    }
  }
});

Hash.prototype.removeItem = function(in_key) {
  var tmp_previous;
  if (typeof this.items[in_key] != 'undefined') {
    this.length--;
    var tmp_previous = this.items[in_key];
    delete this.items[in_key];
  }

  return tmp_previous;
};

Hash.prototype.getItem = function(in_key) {
  return this.items[in_key];
};

Hash.prototype.setItem = function(in_key, in_value) {
  var tmp_previous;
  if (typeof in_value != 'undefined') {
    if (typeof this.items[in_key] == 'undefined') {
      this.length++;
    } else {
      tmp_previous = this.items[in_key];
    }

    this.items[in_key] = in_value;
  }

  return tmp_previous;
};

Hash.prototype.hasItem = function(in_key) {
  return typeof this.items[in_key] != 'undefined';
};

Hash.prototype.clear = function() {
  for (var i in this.items) {
    delete this.items[i];
  }

  this.length = 0;
};


================================================
FILE: lib/deps/edge.js
================================================
/**
 * Module dependencies
 */
var Hash = require('./core_ext/hash').Hash,
  Attributs = require('./attributs').Attributs;

/**
 * Create a new edge
 * @constructor
 * @param {Graph} graph Parent Graph
 * @param {String|Node} nodeOne The first node
 * @param {String|Node} nodeTwo The second node
 * @return {Edge}
 * @api public
 */
var Edge = (exports.Edge = function(graph, nodeOne, nodeTwo) {
  this.relativeGraph = graph;
  this.nodeOne = nodeOne;
  this.nodeTwo = nodeTwo;
  this.attributs = new Attributs('E');
});

/**
 * Set an edge attribut
 *
 * @param {String} name The attribut name
 * @param {Void} value The attribut value
 * @api public
 */
Edge.prototype.set = function(name, value) {
  this.attributs.set(name, value);
  return this;
};

/**
 * Get an edge attribut
 *
 * @param {String} name The attribut name
 * @return {Void}
 * @api public
 */
Edge.prototype.get = function(name) {
  return this.attributs.get(name);
};

/**
 * @api private
 */
Edge.prototype.to_dot = function() {
  var edgeLink = '->';
  if (this.relativeGraph.type === 'graph') {
    edgeLink = '--';
  }

  var edgeOutput = '"' + this.nodeOne.id + '"' + ' ' + edgeLink + ' ' + '"' + this.nodeTwo.id + '"';
  edgeOutput = edgeOutput + this.attributs.to_dot();
  return edgeOutput;
};


================================================
FILE: lib/deps/graph.js
================================================
var which = require('which');

/**
 * Module dependencies
 */
var Hash = require('./core_ext/hash').Hash,
  Node = require('./node').Node,
  Edge = require('./edge').Edge,
  gvattrs = require('./attributs'),
  Attributs = gvattrs.Attributs,
  util = require('util'),
  path = require('path'),
  spawn = require('child_process').spawn;

/**
 * Create a new graph
 * @constructor
 * @param {Graph} graph Parent Graph
 * @param {String} id The graphID
 * @return {Graph}
 * @api public
 */
var Graph = (exports.Graph = function(graph, id) {
  this.relativeGraph = graph;
  this.id = id;
  this.type = 'graph';
  this.isStrict = false;
  this.gvPath = '';
  this.nodes = new Hash();
  this.edges = new Array();
  this.clusters = new Hash();
  if (this.relativeGraph == null) {
    this.graphAttributs = new Attributs('G');
  } else {
    this.graphAttributs = new Attributs('C');
  }
  this.nodesAttributs = new Attributs('N');
  this.edgesAttributs = new Attributs('E');
  this.use = 'dot';
});

/**
 * Create a new node
 *
 * @param {String} id The node ID
 * @param {Object} attrs Node attributs
 * @return {Node}
 * @api public
 */
Graph.prototype.addNode = function(id, attrs) {
  this.nodes.setItem(id, new Node(this, id));
  if (attrs) {
    for (k in attrs) {
      this.nodes.items[id].set(k, attrs[k]);
    }
  }

  return this.nodes.items[id];
};

/**
 * Remove a node
 *
 * @param {String} id The node ID
 * @param {Boolean} force Remove edges related to node
 * @api public
 */
Graph.prototype.removeNode = function(id, force) {
  if (force === true) {
    for (i = 0; i < this.edges.length; ++i) {
      if (this.edges[i].nodeOne.id == id || this.edges[i].nodeTwo.id == id) {
        delete this.edges[i];
      }
    }
  }
  this.nodes.removeItem(id);
};

/**
 * Return a node for a given ID
 *
 * @param {String} id The node ID
 * @return {Node}
 * @api public
 */
Graph.prototype.getNode = function(id) {
  return this.nodes.items[id];
};

Graph.prototype.from = function(id) {
  if (this.nodes.items[id] == undefined) {
    this.addNode(id);
  }
  return this.nodes.items[id];
};

/**
 * Return the number of nodes in the current graph
 *
 * @return {Integer}
 * @api public
 */
Graph.prototype.nodeCount = function() {
  return this.nodes.length;
};

/**
 * Create a new edge
 *
 * @param {String|Node} nodeOne
 * @param {String|Node} nodeTwo
 * @param {Object} attrs Node attributs
 * @return {Edge}
 * @api public
 */
Graph.prototype.addEdge = function(nodeOne, nodeTwo, attrs) {
  var _nodeOne = nodeOne;
  var _nodeTwo = nodeTwo;
  if (typeof nodeOne == 'string') {
    _nodeOne = this.nodes.items[nodeOne];
    if (_nodeOne == null) {
      _nodeOne = this.addNode(nodeOne);
    }
  }
  if (typeof nodeTwo == 'string') {
    _nodeTwo = this.nodes.items[nodeTwo];
    if (_nodeTwo == null) {
      _nodeTwo = this.addNode(nodeTwo);
    }
  }

  var edge = new Edge(this, _nodeOne, _nodeTwo);
  if (attrs) {
    for (k in attrs) {
      edge.set(k, attrs[k]);
    }
  }
  this.edges.push(edge);

  return edge;
};

/**
 * Return the number of edges in the current graph
 *
 * @return {Integer}
 * @api public
 */
Graph.prototype.edgeCount = function() {
  return this.edges.length;
};

/**
 * Create a new subgraph
 *
 * @param {String} id The subgraph ID
 * @return {Graph}
 * @api public
 */
Graph.prototype.addCluster = function(id) {
  var cluster = new Graph(this, id);
  cluster.type = this.type;
  this.clusters.setItem(id, cluster);
  return cluster;
};

/**
 * Return a subgraph for a given ID
 *
 * @param {String} id The subgraph ID
 * @return {Graph}
 * @api public
 */
Graph.prototype.getCluster = function(id) {
  return this.clusters.items[id];
};

/**
 * Return the number of subgraphs in the current graph
 *
 * @return {Integer}
 * @api public
 */
Graph.prototype.clusterCount = function() {
  return this.clusters.length;
};

/**
 * Set a graph attribut
 *
 * @param {String} name The attribut name
 * @param {Void} value The attribut value
 * @api public
 */
Graph.prototype.set = function(name, value) {
  this.graphAttributs.set(name, value);
};

/**
 * Get a graph attribut
 *
 * @param {String} name The attribut name
 * @return {Void}
 * @api public
 */
Graph.prototype.get = function(name) {
  return this.graphAttributs.get(name);
};

/**
 * Set a global node attribut
 *
 * @param {String} name The attribut name
 * @param {Void} value The attribut value
 * @api public
 */
Graph.prototype.setNodeAttribut = function(name, value) {
  this.nodesAttributs.set(name, value);
};

/**
 * Get a global node attribut
 *
 * @param {String} name The attribut name
 * @return {Void}
 * @api public
 */
Graph.prototype.getNodeAttribut = function(name) {
  return this.nodesAttributs.get(name);
};

/**
 * Set a global edge attribut
 *
 * @param {String} name The attribut name
 * @param {Void} value The attribut value
 * @api public
 */
Graph.prototype.setEdgeAttribut = function(name, value) {
  this.edgesAttributs.set(name, value);
};

/**
 * Get a global edge attribut
 *
 * @param {String} name The attribut name
 * @return {Void}
 * @api public
 */
Graph.prototype.getEdgeAttribut = function(name) {
  return this.edgesAttributs.get(name);
};

/**
 * Generate the GraphViz script
 *
 * @return {String}
 * @api public
 */
Graph.prototype.to_dot = function() {
  var dotScript = '';
  if (this.relativeGraph == null) {
    dotScript = this.type + ' "' + this.id + '" {\n';
    if(this.isStrict){
      dotScript = 'strict '+dotScript
    }
  } else {
    dotScript = 'subgraph "' + this.id + '" {\n';
  }

  // Graph attributs
  if (this.graphAttributs.length() > 0) {
    dotScript = dotScript + '  graph' + this.graphAttributs.to_dot() + ';\n';
  }

  // Nodes attributs
  if (this.nodesAttributs.length() > 0) {
    dotScript = dotScript + '  node' + this.nodesAttributs.to_dot() + ';\n';
  }

  // Edges attributs
  if (this.edgesAttributs.length() > 0) {
    dotScript = dotScript + '  edge' + this.edgesAttributs.to_dot() + ';\n';
  }

  // Each clusters
  for (var id in this.clusters.items) {
    if (this.clusters.items.hasOwnProperty(id)) {
      dotScript = dotScript + this.clusters.items[id].to_dot() + '\n';
    }
  }

  // Each nodes
  for (var id in this.nodes.items) {
    if (this.nodes.items.hasOwnProperty(id)) {
      dotScript = dotScript + '  ' + this.nodes.items[id].to_dot() + ';\n';
    }
  }

  // Each edges
  for (var i in this.edges) {
    if (this.edges.hasOwnProperty(i)) {
      dotScript = dotScript + '  ' + this.edges[i].to_dot() + ';\n';
    }
  }

  dotScript = dotScript + '}\n';

  return dotScript;
};

/**
 * Generate an output in file or memory
 *
 * @param {String|Object} type The output file type (png, jpeg, ps, ...) or options
 * @param {String|Function} name_or_callback The output file name or callback
 * @param {Function} errback Error callback
 * @api public
 *
 * Options :
 *   - type : output file type (png, jpeg, ps, ...)
 *   - use : Graphviz command to use (dot, neato, ...)
 *   - path : GraphViz path
 *   - G :
 *   - N :
 *   - E :
 */
Graph.prototype.render = function(type_or_options, name_or_callback, errback) {
  var parameters = [];

  // Get output type
  var type = type_or_options;
  if (typeof type_or_options == 'object') {
    type = type_or_options.type;

    // Get use
    if (type_or_options.use != undefined) {
      this.use = type_or_options.use;
    }

    // Get path
    if (type_or_options.path != undefined) {
      this.gvPath = type_or_options.path;
    }

    // Get extra Graph Options
    if (type_or_options.G != undefined) {
      for (attr in type_or_options.G) {
        if (gvattrs.isValid(attr, 'G') == false) {
          console.error('Warning : Invalid attribut `' + attr + "' for a graph");
        }
        parameters.push('-G' + attr + '=' + type_or_options.G[attr]);
      }
    }
    // Get extra Node Options
    if (type_or_options.N != undefined) {
      for (attr in type_or_options.N) {
        if (gvattrs.isValid(attr, 'N') == false) {
          console.error('Warning : Invalid attribut `' + attr + "' for a node");
        }
        parameters.push('-N' + attr + '=' + type_or_options.N[attr]);
      }
    }
    // Get extra Edge Options
    if (type_or_options.E != undefined) {
      for (attr in type_or_options.E) {
        if (gvattrs.isValid(attr, 'E') == false) {
          console.error('Warning : Invalid attribut `' + attr + "' for an edge");
        }
        parameters.push('-E' + attr + '=' + type_or_options.E[attr]);
      }
    }
  }
  parameters.push('-T' + type);

  var dotScript = this.to_dot();

  var cmd = this.use;
  if (this.gvPath != '') {
    cmd = path.join(this.gvPath, this.use);
  }

  var rendered = null;
  var out = '';
  var err = '';
  var outcallback = function(data) {
    if (rendered == null) {
      rendered = data;
    } else {
      __b = new Buffer(rendered.length + data.length);
      rendered.copy(__b, 0, 0);
      data.copy(__b, rendered.length, 0);
      rendered = __b;
    }
  };

  if (typeof name_or_callback == 'string') {
    parameters.push('-o' + name_or_callback);
    outcallback = function(data) {
      out += data;
    };
  }

  var self = this;

  which(cmd, function(err, cmdPath) {
    if (err) {
      if (errback) {
        errback(-1, out, 'Command ' + cmd + ' not found');
      }
    } else {
      graphviz = spawn(cmdPath, parameters);
      graphviz.stdout.on('data', outcallback);
      graphviz.stderr.on('data', function(data) {
        err += data;
      });
      graphviz.on('exit', function(code) {
        if (code !== 0) {
          if (errback) {
            errback(code, out, err);
          }
        } else {
          if (typeof name_or_callback == 'function') name_or_callback(rendered);
          else if (errback) errback(code, out, err)
        }
      });
      graphviz.stdin.write(self.to_dot());
      graphviz.stdin.end();
    }
  });
};
// Compatibility
Graph.prototype.output = function(type, name_or_callback, errback) {
  this.render(type, name_or_callback, errback);
};

/**
 * Set the GraphViz path
 *
 * @param {String} path The GraphViz path
 * @api public
 */
Graph.prototype.setGraphVizPath = function(path) {
  this.gvPath = path;
};


================================================
FILE: lib/deps/node.js
================================================
/**
 * Module dependencies
 */
var Hash = require('./core_ext/hash').Hash,
  Attributs = require('./attributs').Attributs;

/**
 * Create a new node
 * @constructor
 * @param {Graph} graph Parent Graph
 * @param {String} id The node ID
 * @return {Node}
 * @api public
 */
var Node = (exports.Node = function(graph, id) {
  this.relativeGraph = graph;
  this.id = id;
  this.attributs = new Attributs('N');
});

/**
 *
 */
Node.prototype.to = function(id, attrs) {
  this.relativeGraph.addEdge(this, id, attrs);
  return this.relativeGraph.from(id);
};

/**
 * Set a node attribut
 *
 * @param {String} name The attribut name
 * @param {Void} value The attribut value
 * @api public
 */
Node.prototype.set = function(name, value) {
  this.attributs.set(name, value);
  return this;
};

/**
 * Get a node attribut
 *
 * @param {String} name The attribut name
 * @return {Void}
 * @api public
 */
Node.prototype.get = function(name) {
  return this.attributs.get(name);
};

/**
 * @api private
 */
Node.prototype.to_dot = function() {
  var nodeOutput = '"' + this.id + '"' + this.attributs.to_dot();
  return nodeOutput;
};


================================================
FILE: lib/ext/gvpr/dot2js.g
================================================
// Copyright (c) 2010 Gregoire Lejeune <gregoire.lejeune@free.fr>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
//
// Usage :
//   gvpr -f dot2js.g [-a <output type>] <dot script>

BEGIN {
  int g_strict; int g_direct;
  graph_t cluster;
  node_t cnode;
  edge_t cedge;
  string attr; string attrv;
  graph_t subgraph; graph_t pgraph;
  graph_t ofgraph;

	string xOut;
	if( ARGC == 0 ) {
		xOut = "_";
	} else {
		xOut = tolower(ARGV[0]);
	}

  printf( "// This code was generated by dot2js.g\n\n" );

  string rubyfy( string s ) {
    string out;
    out = tolower( s );
    out = gsub( out, " ", "__" );
    out = gsub( out, "'", "" );
    out = gsub( out, "-", "_" );
    out = gsub( out, ".", "" );
		out = gsub( out, "%", "u" );
		out = gsub( out, "+", "" );
		out = gsub( out, "/", "_" );
    return( out );
  }
}

BEG_G {
  printf( "var util = require('util'),\n  graphviz = require('graphviz');\n\n");
  // Directed
  g_direct = isDirect($);
  if( g_direct == 0 ) {
    printf( "var graph_%s = graphviz.graph( \"%s\" );\n", rubyfy($.name), rubyfy($.name) );
  } else {
    printf( "var graph_%s = graphviz.digraph( \"%s\" );\n", rubyfy($.name), rubyfy($.name) );
  }
  // Strict
  g_strict = isStrict($);
  if( g_strict != 0 ) {
    // printf( ", :strict => true" ); ///////////////////////// TODO
  }

  // Attributs of G
  attr = fstAttr($, "G");
  while( attr != "" ) {
    attrv = aget( $, attr );
    if( attrv != "" ) {
      printf( "graph_%s.set( \"%s\", \"%s\" );\n", rubyfy($.name), attr, attrv );
    }
    attr = nxtAttr( $, "G", attr );
  }

  // Subgraph
  subgraph = fstsubg( $ );
  while( subgraph != NULL ) {
    pgraph = subgraph.parent;
    printf ( "var graph_%s = graph_%s.addCluster( \"%s\" )\n", rubyfy(subgraph.name), rubyfy(pgraph.name), rubyfy(subgraph.name) );

    // ATTRS
    attr = fstAttr(subgraph, "G");
    while( attr != "" ) {
      attrv = aget( subgraph, attr );
      if( attrv != "" ) {
        printf( "graph_%s.set( \"%s\", \"%s\" );\n", rubyfy(subgraph.name), attr, attrv );
      }
      attr = nxtAttr( subgraph, "G", attr );
    }

    subgraph = nxtsubg( subgraph );
  }
}

N {
  pgraph = $.root;
  ofgraph = pgraph;

  subgraph = fstsubg( pgraph );
  while( subgraph != NULL ) {
    if( isSubnode( subgraph, $ ) != 0 ) {
      ofgraph = subgraph;
    }
    subgraph = nxtsubg( subgraph );
  }

  printf( "var node_%s = graph_%s.addNode( \"%s\", {", rubyfy($.name), rubyfy(ofgraph.name), $.name );

  // Attributs of N
  attr = fstAttr($G, "N");
  while( attr != "" ) {
    attrv = aget( $, attr );
    if( attrv != "" ) {
      printf( "\"%s\" : \"%s\", ", attr, gsub( attrv, "'", "\\'" ) );
//    } else {
//      printf( "\"%s\" : \"\", ", attr );
    }
    attr = nxtAttr( $G, "N", attr );
  }

  printf( "} );\n" );
}

E {
  pgraph = $.root;
  ofgraph = pgraph;

  subgraph = fstsubg( pgraph );
  while( subgraph != NULL ) {
    if( isSubedge( subgraph, $ ) != 0 ) {
      ofgraph = subgraph;
    }
    subgraph = nxtsubg( subgraph );
  }

  printf( "graph_%s.addEdge( \"%s\", \"%s\", {", rubyfy(ofgraph.name), $.tail.name, $.head.name );

  // Attributs of E
  attr = fstAttr($G, "E");
  while( attr != "" ) {
    attrv = aget( $, attr );
    if( attrv != "" ) {
      printf( "\"%s\" : \"%s\", ", attr, gsub( attrv, "'", "\\'" ) );
//    } else {
//      printf( "\"%s\" : \"\", ", attr );
    }
    attr = nxtAttr( $G, "E", attr );
  }

  printf( "} );\n" );
}

END_G {
	printf( "__graph_eval = graph_%s;\n", rubyfy($.name) );
}


================================================
FILE: lib/graphviz.js
================================================
/**
 * Module dependencies.
 */
var path = require('path'),
  spawn = require('child_process').spawn,
  temp = require('temp'),
  which = require('which'),
  fs = require('fs'),
  fsExt = require('./deps/core_ext/fs-ext'),
  Graph = require('./deps/graph').Graph;

/**
 * Create a new undirected graph
 * @constructor
 * @param {String} id The graphID
 * @return {Graph}
 * @api public
 */
exports.graph = function(id) {
  var graph = new Graph(null, id);
  graph.type = 'graph';
  return graph;
};

/**
 * Create a new directed graph
 * @constructor
 * @param {String} id The graphID
 * @param {Boolean} isStrict if the Graph is strict
 * @return {Graph}
 * @api public
 */
exports.digraph = function(id, isStrict = false) {
  var graph = new Graph(null, id);
  graph.type = 'digraph';
  graph.isStrict = isStrict;
  return graph;
};

function _parse(file, callback, errback) {
  which('gvpr', function(err, cmdPath) {
    if (err) {
      if (errback) {
        errback(-1, '', 'Command gvpr not found');
      }
    } else {
      var gvprScript = path.join(__dirname, 'ext', 'gvpr', 'dot2js.g'),
        parameters = ['-f' + gvprScript, file],
        __graph_eval,
        err = '',
        out = '',
        graphviz = spawn(cmdPath, parameters);

      graphviz.stdout.on('data', function(data) {
        out += data;
      });
      graphviz.stderr.on('data', function(data) {
        err += data;
      });
      graphviz.stdin.end();
      graphviz.on('exit', function(code) {
        if (code !== 0) {
          if (errback) {
            errback(code, out, err);
          }
        } else {
          eval(out.toString());
          if (typeof __graph_eval == 'undefined') {
            if (errback) {
              errback(code, out, '__graph_eval is not defined in call to graphviz');
            }
          } else {
            callback(__graph_eval);
          }
        }
      });
    }
  });
}
/**
 * Create a new graph from a dot script
 * @constructor
 * @param {String} file_or_script The DOT script or file
 * @param {Function} callback
 * @param {Function} errback
 * @api public
 */
exports.parse = function(file_or_script, callback, errback) {
  if (fsExt.exist(file_or_script)) {
    _parse(file_or_script, callback, errback);
  } else {
    temp.open('node-graphviz', function(err, info) {
      if (err) {
        return errback(err);
      }
      fs.write(info.fd, file_or_script, function(err) {
        if (err) {
          return errback(err);
        }
        fs.close(info.fd, function(err) {
          if (err) {
            return errback(err);
          }
          _parse(info.path, callback, errback);
        });
      });
    });
  }
};


================================================
FILE: package.json
================================================
{
  "name": "graphviz",
  "version": "0.0.9",
  "author": "Gregoire Lejeune <gregoire.lejeune@free.fr> (http://algorithmique.net/)",
  "description": "Node.js interface to the GraphViz graphing tool",
  "homepage": "http://algorithmique.net/",
  "license": "MIT",
  "contributors": [
    "Gregoire Lejeune (http://algorithmique.net)",
    "Mathieu Ravaux (http://mathieuravaux.com)"
  ],
  "repository": {
    "type": "git",
    "url": "http://github.com/glejeune/node-graphviz.git"
  },
  "keywords": [
    "graphviz",
    "dot"
  ],
  "directories": {
    "lib": "./lib"
  },
  "main": "lib/graphviz",
  "engines": {
    "node": ">=0.6.8"
  },
  "dependencies": {
    "temp": "~0.4.0",
    "which": "^1.3.1"
  },
  "devDependencies": {}
}


================================================
FILE: tests/cluster.dot
================================================
digraph G {
	subgraph cluster_0 {
		style=filled;
		color=lightgrey;
		node [style=filled,color=white];
		a0 -> a1;
		a1 -> a2;
		a2 -> a3;
		label = "process #1";
	}

	subgraph cluster_1 {
		node [style=filled];
		b0 -> b1;
		b1 -> b2;
		b2 -> b3;
		label = "process #2";
		color=blue;
	}
	start -> a0;
	start -> b0;
	a1 -> b3;
	b2 -> a3;
	a3 -> a0;
	a3 -> end;
	b3 -> end;

	start [shape=Mdiamond];
	end [shape=Msquare];
}

================================================
FILE: tests/cluster.js
================================================
var util = require('util'),
  graphviz = require('../lib/graphviz');

// digraph G {
var g = graphviz.digraph('G');
// 	subgraph cluster_0 {
var cluster_0 = g.addCluster('cluster_0');
// 		style=filled;
cluster_0.set('style', 'filled');
// 		color=lightgrey;
cluster_0.set('color', 'lightgrey');
// 		node [style=filled,color=white];
cluster_0.setNodeAttribut('style', 'filled');
cluster_0.setNodeAttribut('color', 'white');

// 		a0 -> a1 -> a2 -> a3;
cluster_0.addEdge('a0', 'a1');
cluster_0.addEdge('a1', 'a2');
cluster_0.addEdge('a2', 'a3');
// 		label = "process #1";
cluster_0.set('label', 'process #1');
// 	}

// 	subgraph cluster_1 {
var cluster_1 = g.addCluster('cluster_1');
// 		node [style=filled];
cluster_1.setNodeAttribut('style', 'filled');

// 		b0 -> b1 -> b2 -> b3;
cluster_1.addEdge('b0', 'b1');
cluster_1.addEdge('b1', 'b2');
cluster_1.addEdge('b2', 'b3');
// 		label = "process #2";
cluster_1.set('label', 'process #2');
// 		color = blue
cluster_1.set('color', 'blue');
// 	}

// 	start -> a0;
g.addEdge('start', cluster_0.getNode('a0'));
// 	start -> b0;
g.addEdge('start', cluster_1.getNode('b0'));
// 	a1 -> b3;
g.addEdge(cluster_0.getNode('a1'), cluster_1.getNode('b3'));
// 	b2 -> a3;
g.addEdge(cluster_1.getNode('b2'), cluster_0.getNode('a3'));
// 	a3 -> a0;
g.addEdge(cluster_0.getNode('a3'), cluster_0.getNode('a0'));
// 	a3 -> end;
g.addEdge(cluster_0.getNode('a3'), 'end');
// 	b3 -> end;
g.addEdge(cluster_1.getNode('b3'), 'end');
//
// 	start [shape=Mdiamond];
g.getNode('start').set('shape', 'Mdiamond');
// 	end [shape=Msquare];
g.getNode('end').set('shape', 'Msquare');
// }

g.output('png', 'cluster.png', function(code, out, err) {
  console.log(err);
});


================================================
FILE: tests/compound.js
================================================
var util = require('util'),
	graphviz = require('../lib/graphviz');

// Create digraph G
var g = graphviz.digraph("G");
g.set( "splines", "compound");
g.from( "A" ).to( "B" ).to( "F" );
g.from( "A" ).to( "C" ).to( "D" ).to( "F" );
g.from( "A" ).to( "D" );
g.from( "A" ).to( "F" );
g.from( "C" ).to( "F" );
g.from( "E" ).to( "F" );

g.render( "png", "compound.png" );


================================================
FILE: tests/fdpclust.js
================================================
var util = require('util'),
  graphviz = require('../lib/graphviz');
  
// graph G {
var g = graphviz.graph("G");
//   e
var e = g.addNode( "e" )
//   subgraph clusterA {
var clusterA = g.addCluster( "clusterA" )
//     a -- b;
clusterA.addEdge( "a", "b" )
//     subgraph clusterC {
var clusterC = clusterA.addCluster( "clusterC" )
//       C -- D;
clusterC.addEdge( "C", "D" )
//     }
//   }
//   subgraph clusterB {
var clusterB = g.addCluster( "clusterB" )
clusterB.addEdge( "d", "f" )
//     d -- f
//   }
//   d -- D
g.addEdge( clusterB.getNode("d"), clusterC.getNode("D") )
//   e -- clusterB
g.addEdge( e, clusterB )
//   clusterC -- clusterB
g.addEdge( clusterC, clusterB )
// }

g.use = "fdp"
g.output( "png", "fdpclust.png" ); 


================================================
FILE: tests/hello.js
================================================
var util = require('util'),
	graphviz = require('../lib/graphviz');

// Create digraph G
var g = graphviz.digraph("G");

// Add node (ID: Hello)
var n1 = g.addNode( "Hello" );

// Add node (ID: World)
g.addNode( "World" );

// Add edge between the two nodes
var e = g.addEdge( n1, "World" );

// Generate a PNG output
g.output( {
	"type":"png",
	"use":"dot",
	"N" : {
		"color":"blue",
		"shape":"Mdiamond"
	},
	"E" : {
		"color" : "red",
		"label" : "Say"
	},
	"G" : {
		"label" : "Example"
	}
}, "hello.png" );


================================================
FILE: tests/hello_world.js
================================================
var util = require('util'),
	graphviz = require('../lib/graphviz');

// Create digraph G
var g = graphviz.digraph("G");

// Add node (ID: Hello)
var n1 = g.addNode( "Hello", {"color" : "blue", "shape" : "Mdiamond"} );
//n1.set( "color", "blue" );
n1.set( "style", "filled" );

// Add node (ID: World)
g.addNode( "World" );

// Add edge between the two nodes
g.addEdge(n1, "World")
  .set("color", "red")
  .set("label", "A label")
  .set("fontsize", "10");

// Generate a PNG output
g.output( "png", "hello_world.png" );


================================================
FILE: tests/memory.js
================================================
var util = require('util'),
	graphviz = require('../lib/graphviz');

// Create digraph G
var g = graphviz.digraph("G");

// Add node (ID: Hello)
var n1 = g.addNode( "Hello" );
n1.set( "color", "blue" )
  .set( "style", "filled" );

// Add node (ID: World)
g.addNode( "World" );

// Add edge between the two nodes
var e = g.addEdge( n1, "World" );
e.set( "color", "red" );

// Generate a dot output in-memory
g.render( "png", function(render) {
	process.stdout.write( render );
} );

// Generate a PNG output in-file
g.output( "png", "memory.png" );


================================================
FILE: tests/parse.js
================================================
var util = require('util'),
	graphviz = require('../lib/graphviz');

graphviz.parse( "cluster.dot", function(graph) {
	graph.render( "png", "cluster.png" );
})

graphviz.parse( "cluster.dot", function(graph) {
	graph.render( "png", function(render) {
		process.stdout.write( render );
	}, function(code, out, err) {
		console.log("RENDER ERROR")
		console.log(""+err)
		console.log(""+out)
	});
}, function(code, out, err) {
	console.log("PARSE ERROR")
	console.log(""+err)
	console.log(""+out)
});


================================================
FILE: tests/remove_node.js
================================================
var util = require('util'),
    graphviz = require('../lib/graphviz');


//create a graph
var g = graphviz.digraph("G");

//add some nodes
g.addNode("a");
g.addNode("b");
g.addNode("c");
g.addNode("d");
g.addNode("e");


//add relations
g.addEdge("a", "b");
g.addEdge("a", "c");
g.addEdge("c", "b");
g.addEdge("a", "d");

g.output( "png", "remove_node_original.png" );


//soft removeNode
//will remove the node, but not the edges
g.removeNode("e");
g.output( "png", "remove_node_soft.png" );

//hard removeNode
//removes the node and the edgesfrom and to the node
g.removeNode("c", true);
g.output( "png", "remove_node_hard.png" );

console.log(g.to_dot())


================================================
FILE: tests/server/app.js
================================================
var fs = require('fs');
var util = require('util');
var http = require('http');
var url = require('url');

// npm install express
var express = require('express'),
  app = express.createServer();
// nom install temp
var temp = require('temp');
// npm install graphviz
var graphviz = require('../../lib/graphviz');
// npm install jsmin
var jsmin = require('jsmin').jsmin;

// Configuration --------------------------------------------------------------

app.set('views', __dirname + '/views');
app.configure(function(){ 
  app.use(express.bodyParser());
  app.use(express.static(__dirname + '/static'));
})

// Site -----------------------------------------------------------------------

app.get('/', function(req, res){
    res.render('index.ejs', {});
});

// APIs -----------------------------------------------------------------------

app.get('/dotgraph.min.js', function(req,res) {
  fs.readFile(__dirname+'/static/dotgraph.js', function (err, data) {
    if (err) throw err;
    res.contentType('text/javascript');
    res.send( jsmin(data.toString('utf8') ) );
  });
})

function __do( req, res, data ) {
  graphviz.parse( data, function(graph) {
    graph.render( "png", function(render) {
      img = '<img src="data:image/png;base64,'+render.toString("base64")+'"/>'
      res.send(img)
    }, function(code, out, err) {
      img = '<div class="error"><p><b>Render error (code '+code+')</b></p>';
      img += '<p>STDOUT : '+out+'</p>';
      img += '<p>STDERR : '+err+'</p></div>';
      res.send(img)
    });
  }, function(code, out, err){
    img = '<div class="error"><p><b>Parser error (code '+code+')</b></p>';
    img += '<p>STDERR : '+err+'</p></div>';
    img += '<p>STDOUT : '+out+'</p></div>';
    res.send(img)
  });  
}

app.post('/script', function(req,res){
  __do(req, res, req.body.data)
})

app.get('/file/*', function(req,res){
  var urlData = url.parse(req.params[0]);
  
  var urlPort = urlData.port;
  if( urlPort == undefined ) {
    urlPort = 80;
  }
  var urlHost = urlData.host;
  var urlPath = urlData.pathname;
  
  var client = http.createClient(urlPort, urlHost);
  var request = client.request('GET', urlPath,
    {'host': urlHost});
  request.end();
  request.on('response', function (response) {
    response.setEncoding('utf8');
    if(response.statusCode == 404 ) {
      res.send('<div class="error"><p><b>'+req.params[0]+'</b> does not exist (404 error)</p></div>');
    } else {
      response.on('data', function (chunk) {
        __do(req, res, chunk)
      });
    }
  });
})

app.listen(3000);


================================================
FILE: tests/server/static/dotgraph.js
================================================
var DotGraphClient = {
  version: '0.0.1',
  host: 'http://localhost:3000',
  
  require: function(libraryName) {
    try{
      document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
    } catch(e) {
      var script = document.createElement('script');
      script.type = 'text/javascript';
      script.src = libraryName;
      document.getElementsByTagName('head')[0].appendChild(script);
    }
  },
  
  load: function() {
    DotGraphClient.require( 'http://code.jquery.com/jquery-latest.min.js' );
  }
};

DotGraphClient.load();

var DotGraph = {
  file: function( url, id ) {
    $.get(DotGraphClient.host+'/file/'+url, function(data) {
      $(id).html(data);
    });
  },
  
  script: function( data, id ) {
    $.post(DotGraphClient.host+'/script', { data: data }, function(data) {
      $(id).html(data);
    });
  }
};


================================================
FILE: tests/server/views/index.ejs
================================================
<h1>dotGraph</h1>

<table>
  <tr><td>
    <p>Enter your dot code :</p>
    <textarea id="dot" cols="60" rows="20"></textarea><br />
    <input id="button" type="button" value="Generate" /><br />
    <p>Or give me a script URL :<br/><small>Try http://dl.dropbox.com/u/72629/cluster.dot</p>
    <input id="file" type="text" size="50"/>
    <input id="bouton" type="button" value="Let see!" /><br />
  </td><td>
    <div id="result"></div>
  </td></tr>
</table>

<script type="text/javascript">
  $('#button').click(function() {
    DotGraph.script( $('#dot').val(), '#result' )
  });
</script>

<script type="text/javascript">
  $('#bouton').click(function() {
    DotGraph.file( $('#file').val(), '#result' )
  });
</script>



================================================
FILE: tests/server/views/layout.ejs
================================================
<html>
  <head>
    <style>
      .error {
        border: 2px solid red;
        font-family: Arial;
        padding: 5px;
      }
    </style>
    <script src="/dotgraph.min.js"></script>
  </head>
  <body>
    <%- body %>
  </body>
</html>

================================================
FILE: tests/switch.js
================================================
// This code was generated by dot2js.g

var util = require('util'),
  graphviz = require('../lib/graphviz');

var graph_g = graphviz.digraph( "g" );
graph_g.set( "bgcolor", "#808080" );
graph_g.set( "rankdir", "LR" );
var graph_u1 = graph_g.addCluster( "u1" )
graph_u1.set( "bgcolor", "#808080" );
graph_u1.set( "rankdir", "LR" );
var graph_u3 = graph_g.addCluster( "u3" )
graph_u3.set( "bgcolor", "#808080" );
graph_u3.set( "rankdir", "LR" );
var graph_u5 = graph_g.addCluster( "u5" )
graph_u5.set( "bgcolor", "#808080" );
graph_u5.set( "rankdir", "LR" );
var graph_u7 = graph_g.addCluster( "u7" )
graph_u7.set( "bgcolor", "#808080" );
graph_u7.set( "rankdir", "LR" );
var graph_u15 = graph_g.addCluster( "u15" )
graph_u15.set( "bgcolor", "#808080" );
graph_u15.set( "rankdir", "LR" );
var graph_u23 = graph_g.addCluster( "u23" )
graph_u23.set( "bgcolor", "#808080" );
graph_u23.set( "rankdir", "LR" );
var graph_u31 = graph_g.addCluster( "u31" )
graph_u31.set( "bgcolor", "#808080" );
graph_u31.set( "rankdir", "LR" );
var graph_u39 = graph_g.addCluster( "u39" )
graph_u39.set( "bgcolor", "#808080" );
graph_u39.set( "rankdir", "LR" );
var graph_u47 = graph_g.addCluster( "u47" )
graph_u47.set( "bgcolor", "#808080" );
graph_u47.set( "rankdir", "LR" );
var graph_u55 = graph_g.addCluster( "u55" )
graph_u55.set( "bgcolor", "#808080" );
graph_u55.set( "rankdir", "LR" );
var graph_u63 = graph_g.addCluster( "u63" )
graph_u63.set( "bgcolor", "#808080" );
graph_u63.set( "rankdir", "LR" );
var graph_u71 = graph_g.addCluster( "u71" )
graph_u71.set( "bgcolor", "#808080" );
graph_u71.set( "rankdir", "LR" );
var graph_u89 = graph_g.addCluster( "u89" )
graph_u89.set( "bgcolor", "#808080" );
graph_u89.set( "rankdir", "LR" );
var graph_u107 = graph_g.addCluster( "u107" )
graph_u107.set( "bgcolor", "#808080" );
graph_u107.set( "rankdir", "LR" );
var graph_u125 = graph_g.addCluster( "u125" )
graph_u125.set( "bgcolor", "#808080" );
graph_u125.set( "rankdir", "LR" );
var graph_u143 = graph_g.addCluster( "u143" )
graph_u143.set( "bgcolor", "#808080" );
graph_u143.set( "rankdir", "LR" );
var graph_u177 = graph_g.addCluster( "u177" )
graph_u177.set( "bgcolor", "#808080" );
graph_u177.set( "rankdir", "LR" );
var graph_u211 = graph_g.addCluster( "u211" )
graph_u211.set( "bgcolor", "#808080" );
graph_u211.set( "rankdir", "LR" );
var node_1 = graph_u1.addNode( "1", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
graph_g.addEdge( "1", "a", {"color" : "#0000ff", "dir" : "none", } );
var node_2 = graph_u1.addNode( "2", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
graph_g.addEdge( "2", "b", {"color" : "#ff0000", "dir" : "none", } );
var node_3 = graph_u1.addNode( "3", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
graph_g.addEdge( "3", "c", {"color" : "#ffff00", "dir" : "none", } );
var node_4 = graph_u1.addNode( "4", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
graph_g.addEdge( "4", "d", {"color" : "#00ff00", "dir" : "none", } );
var node_5 = graph_u1.addNode( "5", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
graph_g.addEdge( "5", "e", {"color" : "#000000", "dir" : "none", } );
var node_6 = graph_u1.addNode( "6", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
graph_g.addEdge( "6", "f", {"color" : "#00ffff", "dir" : "none", } );
var node_7 = graph_u1.addNode( "7", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
graph_g.addEdge( "7", "g", {"color" : "#ffffff", "dir" : "none", } );
var node_8 = graph_u1.addNode( "8", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
graph_g.addEdge( "8", "h", {"color" : "#ff00ff", "dir" : "none", } );
var node_10 = graph_u211.addNode( "10", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
var node_20 = graph_u211.addNode( "20", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
var node_30 = graph_u211.addNode( "30", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
var node_40 = graph_u211.addNode( "40", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
var node_50 = graph_u211.addNode( "50", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
var node_60 = graph_u211.addNode( "60", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
var node_70 = graph_u211.addNode( "70", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
var node_80 = graph_u211.addNode( "80", {"height" : "0.3", "shape" : "circle", "style" : "invis", "width" : "0.3", } );
var node_a = graph_u3.addNode( "a", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_g.addEdge( "a", "A", {"color" : "#0000ff", "dir" : "none", } );
graph_g.addEdge( "a", "B", {"color" : "#0000ff", "dir" : "none", } );
var node_b = graph_u3.addNode( "b", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_g.addEdge( "b", "A", {"color" : "#ff0000", "dir" : "none", } );
graph_g.addEdge( "b", "B", {"color" : "#ff0000", "dir" : "none", } );
var node_c = graph_u3.addNode( "c", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_g.addEdge( "c", "C", {"color" : "#ffff00", "dir" : "none", } );
graph_g.addEdge( "c", "D", {"color" : "#ffff00", "dir" : "none", } );
var node_d = graph_u3.addNode( "d", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_g.addEdge( "d", "C", {"color" : "#00ff00", "dir" : "none", } );
graph_g.addEdge( "d", "D", {"color" : "#00ff00", "dir" : "none", } );
var node_e = graph_u3.addNode( "e", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_g.addEdge( "e", "E", {"color" : "#000000", "dir" : "none", } );
graph_g.addEdge( "e", "F", {"color" : "#000000", "dir" : "none", } );
var node_f = graph_u3.addNode( "f", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_g.addEdge( "f", "E", {"color" : "#00ffff", "dir" : "none", } );
graph_g.addEdge( "f", "F", {"color" : "#00ffff", "dir" : "none", } );
var node_g = graph_u3.addNode( "g", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_g.addEdge( "g", "G", {"color" : "#ffffff", "dir" : "none", } );
graph_g.addEdge( "g", "H", {"color" : "#ffffff", "dir" : "none", } );
var node_h = graph_u3.addNode( "h", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_g.addEdge( "h", "G", {"color" : "#ff00ff", "dir" : "none", } );
graph_g.addEdge( "h", "H", {"color" : "#ff00ff", "dir" : "none", } );
var node_i = graph_u71.addNode( "i", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u71.addEdge( "i", "I", {"color" : "#ff0000:#0000ff", "dir" : "none", } );
graph_u71.addEdge( "i", "K", {"color" : "#ff0000:#0000ff", "dir" : "none", } );
var node_j = graph_u71.addNode( "j", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u71.addEdge( "j", "J", {"color" : "#ff0000:#0000ff", "dir" : "none", } );
graph_u71.addEdge( "j", "L", {"color" : "#ff0000:#0000ff", "dir" : "none", } );
var node_k = graph_u89.addNode( "k", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u89.addEdge( "k", "I", {"color" : "#00ff00:#ffff00", "dir" : "none", } );
graph_u89.addEdge( "k", "K", {"color" : "#00ff00:#ffff00", "dir" : "none", } );
var node_l = graph_u89.addNode( "l", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u89.addEdge( "l", "J", {"color" : "#00ff00:#ffff00", "dir" : "none", } );
graph_u89.addEdge( "l", "L", {"color" : "#00ff00:#ffff00", "dir" : "none", } );
var node_m = graph_u107.addNode( "m", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u107.addEdge( "m", "M", {"color" : "#00ffff:#000000", "dir" : "none", } );
graph_u107.addEdge( "m", "O", {"color" : "#00ffff:#000000", "dir" : "none", } );
var node_n = graph_u107.addNode( "n", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u107.addEdge( "n", "N", {"color" : "#00ffff:#000000", "dir" : "none", } );
graph_u107.addEdge( "n", "P", {"color" : "#00ffff:#000000", "dir" : "none", } );
var node_o = graph_u125.addNode( "o", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u125.addEdge( "o", "M", {"color" : "#ff00ff:#ffffff", "dir" : "none", } );
graph_u125.addEdge( "o", "O", {"color" : "#ff00ff:#ffffff", "dir" : "none", } );
var node_p = graph_u125.addNode( "p", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u125.addEdge( "p", "N", {"color" : "#ff00ff:#ffffff", "dir" : "none", } );
graph_u125.addEdge( "p", "P", {"color" : "#ff00ff:#ffffff", "dir" : "none", } );
var node_q = graph_u143.addNode( "q", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u143.addEdge( "q", "Q", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
graph_u143.addEdge( "q", "U", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_r = graph_u143.addNode( "r", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u143.addEdge( "r", "R", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
graph_u143.addEdge( "r", "V", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_s = graph_u143.addNode( "s", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u143.addEdge( "s", "S", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
graph_u143.addEdge( "s", "W", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_t = graph_u143.addNode( "t", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u143.addEdge( "t", "T", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
graph_u143.addEdge( "t", "X", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_u = graph_u177.addNode( "u", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u177.addEdge( "u", "Q", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
graph_u177.addEdge( "u", "U", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
var node_v = graph_u177.addNode( "v", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u177.addEdge( "v", "R", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
graph_u177.addEdge( "v", "V", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
var node_w = graph_u177.addNode( "w", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u177.addEdge( "w", "S", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
graph_u177.addEdge( "w", "W", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
var node_x = graph_u177.addNode( "x", {"height" : "0.3", "shape" : "circle", "width" : "0.3", } );
graph_u177.addEdge( "x", "T", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
graph_u177.addEdge( "x", "X", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
var node_a = graph_u71.addNode( "A", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u71.addEdge( "A", "i", {"color" : "#ff0000:#0000ff", "dir" : "none", } );
var node_b = graph_u71.addNode( "B", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u71.addEdge( "B", "j", {"color" : "#ff0000:#0000ff", "dir" : "none", } );
var node_c = graph_u89.addNode( "C", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u89.addEdge( "C", "k", {"color" : "#00ff00:#ffff00", "dir" : "none", } );
var node_d = graph_u89.addNode( "D", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u89.addEdge( "D", "l", {"color" : "#00ff00:#ffff00", "dir" : "none", } );
var node_e = graph_u107.addNode( "E", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u107.addEdge( "E", "m", {"color" : "#00ffff:#000000", "dir" : "none", } );
var node_f = graph_u107.addNode( "F", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u107.addEdge( "F", "n", {"color" : "#00ffff:#000000", "dir" : "none", } );
var node_g = graph_u125.addNode( "G", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u125.addEdge( "G", "o", {"color" : "#ff00ff:#ffffff", "dir" : "none", } );
var node_h = graph_u125.addNode( "H", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u125.addEdge( "H", "p", {"color" : "#ff00ff:#ffffff", "dir" : "none", } );
var node_i = graph_u143.addNode( "I", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u143.addEdge( "I", "q", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_j = graph_u143.addNode( "J", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u143.addEdge( "J", "r", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_k = graph_u143.addNode( "K", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u143.addEdge( "K", "s", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_l = graph_u143.addNode( "L", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u143.addEdge( "L", "t", {"color" : "#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_m = graph_u177.addNode( "M", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u177.addEdge( "M", "u", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
var node_n = graph_u177.addNode( "N", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u177.addEdge( "N", "v", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
var node_o = graph_u177.addNode( "O", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u177.addEdge( "O", "w", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
var node_p = graph_u177.addNode( "P", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u177.addEdge( "P", "x", {"color" : "#ff00ff:#ffffff:#00ffff:#000000", "dir" : "none", } );
var node_q = graph_u211.addNode( "Q", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u211.addEdge( "Q", "10", {"color" : "#ff00ff:#ffffff:#00ffff:#000000:#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_r = graph_u211.addNode( "R", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u211.addEdge( "R", "20", {"color" : "#ff00ff:#ffffff:#00ffff:#000000:#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_s = graph_u211.addNode( "S", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u211.addEdge( "S", "30", {"color" : "#ff00ff:#ffffff:#00ffff:#000000:#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_t = graph_u211.addNode( "T", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u211.addEdge( "T", "40", {"color" : "#ff00ff:#ffffff:#00ffff:#000000:#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_u = graph_u211.addNode( "U", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u211.addEdge( "U", "50", {"color" : "#ff00ff:#ffffff:#00ffff:#000000:#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_v = graph_u211.addNode( "V", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u211.addEdge( "V", "60", {"color" : "#ff00ff:#ffffff:#00ffff:#000000:#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_w = graph_u211.addNode( "W", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u211.addEdge( "W", "70", {"color" : "#ff00ff:#ffffff:#00ffff:#000000:#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
var node_x = graph_u211.addNode( "X", {"height" : "0.3", "shape" : "diamond", "width" : "0.3", } );
graph_u211.addEdge( "X", "80", {"color" : "#ff00ff:#ffffff:#00ffff:#000000:#00ff00:#ffff00:#ff0000:#0000ff", "dir" : "none", } );
__graph_eval = graph_g;

__graph_eval.render( "png", "switch.png" );
Download .txt
gitextract_83we1a8e/

├── .all-contributorsrc
├── .eslintignore
├── .eslintrc.json
├── .gitignore
├── .prettierrc
├── CHANGELOG.md
├── Jakefile.js
├── LICENCE.txt
├── README.md
├── lib/
│   ├── deps/
│   │   ├── attributs.js
│   │   ├── core_ext/
│   │   │   ├── fs-ext.js
│   │   │   └── hash.js
│   │   ├── edge.js
│   │   ├── graph.js
│   │   └── node.js
│   ├── ext/
│   │   └── gvpr/
│   │       └── dot2js.g
│   └── graphviz.js
├── package.json
└── tests/
    ├── cluster.dot
    ├── cluster.js
    ├── compound.js
    ├── fdpclust.js
    ├── hello.js
    ├── hello_world.js
    ├── memory.js
    ├── parse.js
    ├── remove_node.js
    ├── server/
    │   ├── app.js
    │   ├── static/
    │   │   └── dotgraph.js
    │   └── views/
    │       ├── index.ejs
    │       └── layout.ejs
    └── switch.js
Download .txt
SYMBOL INDEX (5 symbols across 3 files)

FILE: lib/deps/attributs.js
  function mustBeQuoted (line 190) | function mustBeQuoted(data) {
  function quoteMe (line 194) | function quoteMe(attr, value) {
  function validateAttribut (line 204) | function validateAttribut(name, type) {

FILE: lib/graphviz.js
  function _parse (line 40) | function _parse(file, callback, errback) {

FILE: tests/server/app.js
  function __do (line 40) | function __do( req, res, data ) {
Condensed preview — 32 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (79K chars).
[
  {
    "path": ".all-contributorsrc",
    "chars": 2477,
    "preview": "{\n  \"projectName\": \"node-graphviz\",\n  \"projectOwner\": \"glejeune\",\n  \"repoType\": \"github\",\n  \"repoHost\": \"https://github."
  },
  {
    "path": ".eslintignore",
    "chars": 10,
    "preview": "test/data\n"
  },
  {
    "path": ".eslintrc.json",
    "chars": 1029,
    "preview": "{\n  \"root\": true,\n  \"extends\": [\"airbnb-base\", \"prettier\", \"plugin:promise/recommended\", \"plugin:node/recommended\"],\n  \""
  },
  {
    "path": ".gitignore",
    "chars": 75,
    "preview": ".DS_Store\ndoc\npkg\ntest/output/\ndocumentation.html\nnode_modules/\ntest/*.png\n"
  },
  {
    "path": ".prettierrc",
    "chars": 89,
    "preview": "{\n  \"singleQuote\": true,\n  \"trailingComma\": \"es5\",\n  \"printWidth\": 120,\n  \"semi\": true\n}\n"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 3348,
    "preview": "# Change Log\n\n## [0.0.9](https://github.com/glejeune/node-graphviz/tree/0.0.9) (2019-04-03)\n[Full Changelog](https://git"
  },
  {
    "path": "Jakefile.js",
    "chars": 1205,
    "preview": "// This file is a node-jake file -- http://github.com/mde/node-jake\n\nvar util = require('util'),\n\texec  = require('child"
  },
  {
    "path": "LICENCE.txt",
    "chars": 1087,
    "preview": "Copyright (c) 2010 Gregoire Lejeune <gregoire.lejeune@free.fr>\n\nPermission is hereby granted, free of charge, to any per"
  },
  {
    "path": "README.md",
    "chars": 5674,
    "preview": "# Node.js GraphViz Module\n\n[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-sq"
  },
  {
    "path": "lib/deps/attributs.js",
    "chars": 8983,
    "preview": "var Hash = require('./core_ext/hash').Hash,\n  util = require('util');\n\nvar attrs = {\n  Damping: { usage: 'G', type: 'dou"
  },
  {
    "path": "lib/deps/core_ext/fs-ext.js",
    "chars": 145,
    "preview": "var fs = require('fs');\n\nexports.exist = function(path) {\n  try {\n    fs.statSync(path);\n  } catch (e) {\n    return fals"
  },
  {
    "path": "lib/deps/core_ext/hash.js",
    "chars": 1126,
    "preview": "var Hash = (exports.Hash = function() {\n  this.length = 0;\n  this.items = new Array();\n  for (var i = 0; i < arguments.l"
  },
  {
    "path": "lib/deps/edge.js",
    "chars": 1276,
    "preview": "/**\n * Module dependencies\n */\nvar Hash = require('./core_ext/hash').Hash,\n  Attributs = require('./attributs').Attribut"
  },
  {
    "path": "lib/deps/graph.js",
    "chars": 10203,
    "preview": "var which = require('which');\n\n/**\n * Module dependencies\n */\nvar Hash = require('./core_ext/hash').Hash,\n  Node = requi"
  },
  {
    "path": "lib/deps/node.js",
    "chars": 1123,
    "preview": "/**\n * Module dependencies\n */\nvar Hash = require('./core_ext/hash').Hash,\n  Attributs = require('./attributs').Attribut"
  },
  {
    "path": "lib/ext/gvpr/dot2js.g",
    "chars": 4161,
    "preview": "// Copyright (c) 2010 Gregoire Lejeune <gregoire.lejeune@free.fr>\n//\n// This program is free software; you can redistrib"
  },
  {
    "path": "lib/graphviz.js",
    "chars": 2683,
    "preview": "/**\n * Module dependencies.\n */\nvar path = require('path'),\n  spawn = require('child_process').spawn,\n  temp = require('"
  },
  {
    "path": "package.json",
    "chars": 741,
    "preview": "{\n  \"name\": \"graphviz\",\n  \"version\": \"0.0.9\",\n  \"author\": \"Gregoire Lejeune <gregoire.lejeune@free.fr> (http://algorithm"
  },
  {
    "path": "tests/cluster.dot",
    "chars": 424,
    "preview": "digraph G {\n\tsubgraph cluster_0 {\n\t\tstyle=filled;\n\t\tcolor=lightgrey;\n\t\tnode [style=filled,color=white];\n\t\ta0 -> a1;\n\t\ta1"
  },
  {
    "path": "tests/cluster.js",
    "chars": 1697,
    "preview": "var util = require('util'),\n  graphviz = require('../lib/graphviz');\n\n// digraph G {\nvar g = graphviz.digraph('G');\n// \t"
  },
  {
    "path": "tests/compound.js",
    "chars": 367,
    "preview": "var util = require('util'),\n\tgraphviz = require('../lib/graphviz');\n\n// Create digraph G\nvar g = graphviz.digraph(\"G\");\n"
  },
  {
    "path": "tests/fdpclust.js",
    "chars": 740,
    "preview": "var util = require('util'),\n  graphviz = require('../lib/graphviz');\n  \n// graph G {\nvar g = graphviz.graph(\"G\");\n//   e"
  },
  {
    "path": "tests/hello.js",
    "chars": 513,
    "preview": "var util = require('util'),\n\tgraphviz = require('../lib/graphviz');\n\n// Create digraph G\nvar g = graphviz.digraph(\"G\");\n"
  },
  {
    "path": "tests/hello_world.js",
    "chars": 521,
    "preview": "var util = require('util'),\n\tgraphviz = require('../lib/graphviz');\n\n// Create digraph G\nvar g = graphviz.digraph(\"G\");\n"
  },
  {
    "path": "tests/memory.js",
    "chars": 549,
    "preview": "var util = require('util'),\n\tgraphviz = require('../lib/graphviz');\n\n// Create digraph G\nvar g = graphviz.digraph(\"G\");\n"
  },
  {
    "path": "tests/parse.js",
    "chars": 499,
    "preview": "var util = require('util'),\n\tgraphviz = require('../lib/graphviz');\n\ngraphviz.parse( \"cluster.dot\", function(graph) {\n\tg"
  },
  {
    "path": "tests/remove_node.js",
    "chars": 658,
    "preview": "var util = require('util'),\n    graphviz = require('../lib/graphviz');\n\n\n//create a graph\nvar g = graphviz.digraph(\"G\");"
  },
  {
    "path": "tests/server/app.js",
    "chars": 2548,
    "preview": "var fs = require('fs');\nvar util = require('util');\nvar http = require('http');\nvar url = require('url');\n\n// npm instal"
  },
  {
    "path": "tests/server/static/dotgraph.js",
    "chars": 860,
    "preview": "var DotGraphClient = {\n  version: '0.0.1',\n  host: 'http://localhost:3000',\n  \n  require: function(libraryName) {\n    tr"
  },
  {
    "path": "tests/server/views/index.ejs",
    "chars": 725,
    "preview": "<h1>dotGraph</h1>\n\n<table>\n  <tr><td>\n    <p>Enter your dot code :</p>\n    <textarea id=\"dot\" cols=\"60\" rows=\"20\"></text"
  },
  {
    "path": "tests/server/views/layout.ejs",
    "chars": 242,
    "preview": "<html>\n  <head>\n    <style>\n      .error {\n        border: 2px solid red;\n        font-family: Arial;\n        padding: 5"
  },
  {
    "path": "tests/switch.js",
    "chars": 16017,
    "preview": "// This code was generated by dot2js.g\n\nvar util = require('util'),\n  graphviz = require('../lib/graphviz');\n\nvar graph_"
  }
]

About this extraction

This page contains the full source code of the glejeune/node-graphviz GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 32 files (70.1 KB), approximately 23.9k tokens, and a symbol index with 5 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!