tinkerpop/tinkerpop3 — pull request #52 by randompi (2014-08-13 16:08:14+00:00)
Title: Remote Gremlin Console Gephi Visualization of Graph Traversals

Added the ability to visualize graph traversals in the remote console to gephi plugin by leveraging the memory in a traversal with explicitly numbered store steps. I also replaced two existing calls to it.instance() with it.get() to fix bugs introduced by gremlin-core changes. Here is an example gremlin console session:

```
localhost:gremlin-console barnhart$ bin/gremlin.sh

\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: gephi
gremlin> g = TinkerFactory.createClassic()
==>tinkergraph[vertices:6 edges:6]
gremlin> :remote connect gephi
==>connection to Gephi - http://localhost:8080/workspace0 with stepDelay:1000, startRGBColor:[0.0, 1.0, 0.5], colorToFade:g, colorFadeRate:0.7
gremlin> :> g
gremlin> :remote config stepDelay 3000
==>connection to Gephi - http://localhost:8080/workspace0 with stepDelay:3000, startRGBColor:[0.0, 1.0, 0.5], colorToFade:g, colorFadeRate:0.7
gremlin> :remote config colorFadeRate 0.9
==>connection to Gephi - http://localhost:8080/workspace0 with stepDelay:3000, startRGBColor:[0.0, 1.0, 0.5], colorToFade:g, colorFadeRate:0.9
gremlin> d1 = g.v(1).store.as('1').out.store.as('2')
==>[v[3], v[2], v[4]]
gremlin> :> d1
Visualizing vertices at step: 1... visited: 1
Visualizing vertices at step: 2... visited: 3
gremlin> :> g.v(2).store.as('1').in.store.as('2')
==>[v[1]]
Visualizing vertices at step: 1... visited: 1
Visualizing vertices at step: 2... visited: 1
gremlin> :remote connect gephi workspace0 localhost 8080 500 [1.0,0.7,0.3] r 0.5
configVizOptions for: [500, [1.0,0.7,0.3], r, 0.5]
==>connection to Gephi - http://localhost:8080/workspace0 with stepDelay:500, startRGBColor:[1.0, 0.7, 0.3], colorToFade:r, colorFadeRate:0.5
gremlin>
```

The main traversal visualization configuration options are:
- stepDelay: The number of milliseconds to sleep between sending visualization updates to streaming Gephi Server
- startRGBColor: A size 3 float array of rgb color values which define the color to update visited nodes with
- colorToFade: A single char from the set {r,g,b,R,G,B} which describes which color to fade for prior steps
- colorFadeRate: A float value in the range (0.0, 1.0] which is multiplied against the current colorToFade value for prior vertices, a 1.0 value effectively turns off the color fading of prior stepped vertices

Note that you must explicitly submit the graph of interest to Gephi first. I decided that this will be the preferred process for users of this tool because they will most likely want to adjust their viewing window, node sizes, colors, layouts before trying to visualize a traversal. You can directly submit a traversal query without having to store it in a variable first. This code also assumes that the user is calling store.as('1')...store.as('n') in ascending order which is the order that the updates for visualization are processed in.

I'll be submitting a video demo for these features later today that I'll post to the gremlin-users group.

Happy gremlin-in'
~ r∆nd0mP!