TitanDB or JanusGraph (forked from TitanDB 1.0.0) with BerkeleyDB can be used both embedded with Java or Separate Server.
If you are using maven just add these dependencies in the pom file :
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
<artifactId>titan-core</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
<artifactId>titan-berkeleyje</artifactId>
<version>1.0.0</version>
</dependency>
Sample Code :
ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
config.set(GraphDatabaseConfiguration.STORAGE_BACKEND, "berkeleyje");
config.set(GraphDatabaseConfiguration.STORAGE_DIRECTORY,"data");
TitanGraph graph = TitanFactory.open(config);
TitanManagement mgmt = graph.openManagement();
mgmt.makePropertyKey("name").dataType(String.class).make();
mgmt.makeEdgeLabel("friend").make();
mgmt.commit();
TitanTransaction tx = graph.newTransaction();
Vertex ashaful = tx.addVertex("name", "Ashraful Islam");
Vertex jishnu = tx.addVertex("name", "Jishnu Banerjee");
Vertex ovi = tx.addVertex("name", "Ahsanul Haque Ovi");
ashaful.addEdge("friend", jishnu);
jishnu.addEdge("friend", ovi);
tx.commit();
GraphTraversalSource g = graph.traversal();
GraphTraversal result = g.V().has("name", "Ashraful Islam").out("friend").out("friend").values("name");
while (result.hasNext()) {
System.out.println(result.next());
}
graph.close();
TitanDB or JanusGraph node don't communicate with each other, you have to use a common storage backend cluster (Cassandra/HBase) for all of your node so that their data is consistent.