|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgraphlab.SparseGraph
public class SparseGraph
Efficient representation for sparse graphs. Default Graph class to be used.
| Field Summary | |
|---|---|
protected Vertex[] |
vertices
|
| Constructor Summary | |
|---|---|
SparseGraph()
Constructor. |
|
SparseGraph(int n)
Creates a new graph with estimated number of vertices. |
|
| Method Summary | |
|---|---|
void |
addEdge(Edge e,
int fromVertex,
int toVertex)
Add a directed edge |
protected Vertex |
addVertex(int vertexId,
Vertex vertex)
|
Vertex |
addVertex(Vertex vertex)
Add a vertex to the graph. |
protected void |
checksize(int vertexId)
Grows the data structures if needed |
int[] |
children(int vertex)
Returns list of outbound neighbors of a vertex. |
void |
finalizeGraph()
|
Edge |
getEdge(int sourceVertexId,
int targetVertexId)
Returns an edge from source vertex to target vertex. |
int |
getNumOfVertices()
Returns the number of vertices in graph. |
Vertex |
getVertex(int vid)
Returns Vertex object of given id. |
Vertex[] |
getVertices()
Returns a copy of vertex-array of the graph. |
boolean |
isColoringEnabled()
Whether this graph is a "colored" graph. |
int[] |
parents(int vertex)
Returns list of inbound neighbors of a vertex. |
void |
setVertexColor(int vertex,
int vertex_color)
Set vertex color. |
java.lang.String |
toString()
|
int[] |
vertices()
Returns a copy of vertex ids of a graph. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Vertex[] vertices
| Constructor Detail |
|---|
public SparseGraph()
public SparseGraph(int n)
n - estimated number of vertices| Method Detail |
|---|
public Vertex getVertex(int vid)
getVertex in interface Graphvid - vertex id (>=0)
java.lang.ArrayIndexOutOfBoundsExceptionpublic Vertex addVertex(Vertex vertex)
addVertex in interface Graphvertex -
protected Vertex addVertex(int vertexId,
Vertex vertex)
public void setVertexColor(int vertex,
int vertex_color)
setVertexColor in interface Graphvertex - vertex idvertex_color - color id. Color must be integer between 0 and 255.
public void addEdge(Edge e,
int fromVertex,
int toVertex)
addEdge in interface Graphe - edge object encapsulating edge datafromVertex - vertex id of the source vertextoVertex - vertex id of the target vertexpublic int[] vertices()
public int[] children(int vertex)
children in interface Graphvertex - id of vertex
public int[] parents(int vertex)
parents in interface Graphvertex - id of vertex
protected void checksize(int vertexId)
vertexId - public Vertex[] getVertices()
getVertices in interface Graph
public Edge getEdge(int sourceVertexId,
int targetVertexId)
getEdge in interface GraphsourceVertexId - vertex id of the origin vertextargetVertexId - vertex id of the destination vertex
public boolean isColoringEnabled()
isColoringEnabled in interface Graphpublic int getNumOfVertices()
getNumOfVertices in interface Graphpublic void finalizeGraph()
finalizeGraph in interface Graphpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||