Skip to content

@peterneubauer /gist:2652082
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Basic Graphviz
Transaction tx = neo.beginTx();
try
{
final Node emil = neo.createNode();
emil.setProperty( "name", "Emil Eifrém" );
emil.setProperty( "age", 30 );
final Node tobias = neo.createNode();
tobias.setProperty( "name", "Tobias \"thobe\" Ivarsson" );
tobias.setProperty( "age", 23 );
tobias.setProperty( "hours", new int[] { 10, 10, 4, 4, 0 } );
final Node johan = neo.createNode();
johan.setProperty( "!<>)", "!<>)" );
johan.setProperty( "name", "!<>Johan '\\n00b' !<>Svensson" );
final Relationship emilKNOWStobias = emil.createRelationshipTo(
tobias, type.KNOWS );
emilKNOWStobias.setProperty( "since", "2003-08-17" );
final Relationship johanKNOWSemil = johan.createRelationshipTo(
emil, type.KNOWS );
final Relationship tobiasKNOWSjohan = tobias.createRelationshipTo(
johan, type.KNOWS );
final Relationship tobiasWORKS_FORemil = tobias
.createRelationshipTo( emil, type.WORKS_FOR );
OutputStream out = new ByteArrayOutputStream();
GraphvizWriter writer = new GraphvizWriter();
writer.emit( out, Walker.crosscut( emil.traverse( Order.DEPTH_FIRST,
StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL, type.KNOWS,
Direction.BOTH, type.WORKS_FOR, Direction.BOTH ), type.KNOWS, type.WORKS_FOR ) );
tx.success();
System.out.println( out.toString() );
}
finally
{
tx.finish();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.