Created
September 19, 2013 14:17
-
-
Save okram/6624162 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Marko A. Rodriguez (http://markorodriguez.com) | |
*/ | |
public class TinkerFactory { | |
public static TinkerGraph createTinkerGraph() { | |
TinkerGraph graph = new TinkerGraph(); | |
Vertex marko = graph.addVertex(TinkerProperty.of(Property.Key.ID, 1, "name", "marko", "age", 29)); | |
Vertex vadas = graph.addVertex(TinkerProperty.of(Property.Key.ID, 2, "name", "vadas", "age", 27)); | |
Vertex lop = graph.addVertex(TinkerProperty.of(Property.Key.ID, 3, "name", "lop", "lang", "java")); | |
Vertex josh = graph.addVertex(TinkerProperty.of(Property.Key.ID, 4, "name", "josh", "age", 32)); | |
Vertex ripple = graph.addVertex(TinkerProperty.of(Property.Key.ID, 5, "name", "ripple", "lang", "java")); | |
Vertex peter = graph.addVertex(TinkerProperty.of(Property.Key.ID, 6, "name", "peter", "age", 35)); | |
marko.addEdge("knows", vadas, TinkerProperty.of(Property.Key.ID, 7, "weight", 0.5f)); | |
marko.addEdge("knows", josh, TinkerProperty.of(Property.Key.ID, 8, "weight", 1.0f)); | |
marko.addEdge("created", lop, TinkerProperty.of(Property.Key.ID, 9, "weight", 0.4f)); | |
josh.addEdge("created", ripple, TinkerProperty.of(Property.Key.ID, 10, "weight", 1.0f)); | |
josh.addEdge("created", lop, TinkerProperty.of(Property.Key.ID, 11, "weight", 0.4f)); | |
peter.addEdge("created", lop, TinkerProperty.of(Property.Key.ID, 12, "weight", 0.2f)); | |
return graph; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment