Skip to content

Interacting with the Graph

pstutz edited this page Dec 12, 2012 · 5 revisions

The main way to interact with the graph is via the Graph object which is usually created by calling GraphBuilder.build . This returns an instance of Graph. Graph extends GraphEditor, which offers various methods for interacting with the graph, such as addVertex and addEdge. There are also functions to send signals along virtual edges.

Example of how to build a graph:

val graph = GraphBuilder.build
graph.addVertex(new PageRankVertex(id=1))
graph.addVertex(new PageRankVertex(id=2))
graph.addEdge(sourceVertexId=1, new PageRankEdge(targetId=2))
graph.addEdge(sourceVertexId=2, new PageRankEdge(targetId=1))

Previous: Execution Modes

Next: Algorithm Termination