com.intel.hadoop.graphbuilder.graph
Interface Graph<VidType,VertexData,EdgeData>

Type Parameters:
VidType -
VertexData -
EdgeData -
All Known Implementing Classes:
GLGraph, SimpleGraph, SimpleSubGraph

public interface Graph<VidType,VertexData,EdgeData>

A distributed graph partition consists of 3 parts: a partition id, a collection of local edges, and a collection of VertexRecords.


Method Summary
 void addEdge(VidType source, VidType target, EdgeData edata)
          Add a single edge to the graph.
 void addEdges(java.util.List<VidType> sources, java.util.List<VidType> targets, java.util.List<EdgeData> edata)
          Batch add a collection of edges to the graph.
 void addVertexRecord(VertexRecord<VidType,VertexData> vrecord)
          Add a vertex record to the graph.
 void clear()
          Reset the graph to its initial empty state.
 void finalize()
          This method shall be called to ensure that the graph is in its finalized state and is ready for output.
 int numEdges()
           
 int numVertices()
           
 int pid()
           
 void reserveEdgeSpace(int numEdges)
           
 void reserveVertexSpace(int numVertices)
           
 void setPid(int pid)
           
 

Method Detail

pid

int pid()
Returns:
partition id of this graph.

setPid

void setPid(int pid)
Parameters:
pid - partition id of this graph.

reserveEdgeSpace

void reserveEdgeSpace(int numEdges)
Parameters:
numEdges - expected number of edges in the graph.

reserveVertexSpace

void reserveVertexSpace(int numVertices)
Parameters:
numVertices - expected number of vertices in the graph.

numVertices

int numVertices()
Returns:
number of vertices in the graph.

numEdges

int numEdges()
Returns:
number of edges in the graph.

addEdges

void addEdges(java.util.List<VidType> sources,
              java.util.List<VidType> targets,
              java.util.List<EdgeData> edata)
              throws java.lang.Exception
Batch add a collection of edges to the graph.

Parameters:
sources - List of source vertex ids.
targets - List of target vertex ids.
edata - List of edge data.
Throws:
java.lang.Exception - when any of the input is null or sources, targets and edata are of different length

addEdge

void addEdge(VidType source,
             VidType target,
             EdgeData edata)
Add a single edge to the graph.

Parameters:
source - the source vertex id of the edge to be added.
target - the target vertex id of the edge to be added.
edata - the edge data of the edge to be added.

addVertexRecord

void addVertexRecord(VertexRecord<VidType,VertexData> vrecord)
Add a vertex record to the graph.

Parameters:
vrecord - the VertexRecord object to be added.
See Also:
VertexRecord

finalize

void finalize()
              throws java.lang.Exception
This method shall be called to ensure that the graph is in its finalized state and is ready for output.

Throws:
java.lang.Exception

clear

void clear()
Reset the graph to its initial empty state.