neo4j visualization with JSF: integration with Vivagraph SVG, simple example from tutorial

In the internet a lot of question how to show graph in the web page, mostly asked from java developers.
A lot of js technologies support neo4j visualization , but how to pass data from java to js in the web page?
Imagine you have already graph object from java – nodes and links. I used Vivagraph SVG for this example. You can extend it.

First we have JSF bean which contains our simpe graph nodes and edges, like

After we change the Vivagraph SVG simple example code, passing values from JSF bean, instead static data which you can find in the example.

You can see that
I used
graph.addNode(‘${graphBean.firstNode}’, ’91bad8ceeec43ae303790f8fe238164b’);
graph.addNode(‘${graphBean.secondNode}’, ‘d43e8ea63b61e7669ded5b9d3c2e980f’);

graph.addLink(‘${graphBean.firstNode}’, ‘${graphBean.secondNode}’);

instead of
graph.addNode(‘anvaka’, ’91bad8ceeec43ae303790f8fe238164b’);
graph.addNode(‘indexzero’, ‘d43e8ea63b61e7669ded5b9d3c2e980f’);
graph.addLink(‘anvaka’, ‘indexzero’);

as a result


Get Example from