<commit_before>gremlin-graphviz
================

Use Graphviz to visualize Gremlin graphs.

This module is a mashup of [gremlin-v3](https://github.com/jimlloyd/gremlin-v3) and
[node-graphviz](https://github.com/glejeune/node-graphviz).

## Usage

You must first install the Graphviz package in a platform-specific manner.

Check out the unit tests.

```js
var gremlin = require('gremlin-v3');
var gremlinGraphviz = require('gremlin-graphviz');

// TODO
```<commit_msg>Finish the example code in the README.<commit_after>gremlin-graphviz
================

Use Graphviz to visualize Gremlin graphs.

This module is a mashup of [gremlin-v3](https://github.com/jimlloyd/gremlin-v3) and
[node-graphviz](https://github.com/glejeune/node-graphviz).

## Usage

You must first install the Graphviz package in a platform-specific manner.

Check out the unit tests for more, but here is a taste:

```js
// Create a Gremlin graph with some data.
var Gremlin = require('gremlin-v3');
var gremlin = new Gremlin();
var TinkerFactory = gremlin.java.import('com.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory');
var gremlinGraph = gremlin.wrap(TinkerFactory.createClassicSync());

// Create a Graphviz graph (promise) representing the Gremlin graph.
var gremlinGraphviz = require('gremlin-graphviz');
gremlinGraphviz(gremlinGraph).
  then(function (graphvizGraph) {

    // Create a dot representation (synchronous).
    var dotGraph = graphvizGraph.to_dot();

    // Create a force-directed graph PNG (async).
    graphvizGraph.use = 'fdp';
    graphvizGraph.output('png', function (data) {

      // Save it as a file.
      require('fs').writeFileSync('graph.png', data);

    }, function (code, stdout, stderr) {
      // If something goes wrong with the 'fdp' command...
      throw new Error('fdp failed: ' + stderr);
    });
  });
```
{'fraction_non_alphanumeric': 0.14028384279475983, 'fraction_numerical': 0.0032751091703056767, 'mean_word_length': 4.222222222222222, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2383848', 'n_tokens_mistral': 632, 'n_tokens_neox': 582, 'n_words': 166}