|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgraphlab.library.BaseGraph<VertexType,EdgeType>
public abstract class BaseGraph<VertexType extends BaseVertex,EdgeType extends BaseEdge<VertexType>>
Generic base class for representation of all types of graphs.
| Constructor Summary | |
|---|---|
BaseGraph()
|
|
| Method Summary | |
|---|---|
abstract void |
checkVertex(VertexType v)
If the supplied vertex is invalid (Not one of graph's vertices), throws InvalidVertexException. |
abstract void |
clear()
Clears the graph. |
abstract boolean |
containsVertex(VertexType v)
This method returns true if the graph contains the specified vertex, false otherwise. |
abstract BaseGraph<VertexType,EdgeType> |
copy(GraphConverter<EdgeType,EdgeType,VertexType,VertexType> gc)
Creates a clone of the current graph using the GraphConverter object which is responsible for duplication of the graph elements (edges and vertices). |
abstract BaseGraph<VertexType,EdgeType> |
createEmptyGraph()
Returns a new instance of an empty graph of the current graph type. |
abstract void |
dump()
Prints the Adjacency Matrix to the standard output. |
abstract java.util.Iterator<EdgeType> |
edgeIterator()
Constructs and returns an Edge Iterator object which iterates through all the edges in the graph. |
abstract java.util.Iterator<EdgeType> |
edgeIterator(VertexType v)
Constructs an Edge Iterator object which iterates through all the edges going to or coming from the specified vertex v. |
abstract java.util.Iterator<EdgeType> |
edgeIterator(VertexType v,
boolean head)
Constructs an Edge Iterator object which iterates through all the edges going to or coming from (depending on the second parameter) the specified vertex v. |
abstract Jama.Matrix |
getAdjacencyMatrix()
Returns a Jama Matrix object that represents adjacency matrix of the graph. |
abstract int[][] |
getEdgeArray()
Returns array of array of 'int's where represents a simple adjacency list. |
abstract java.util.Collection<EdgeType> |
getEdges(VertexType head,
VertexType tail)
Returns a collection of all edges which connects two vertices supplied as first and second arguments of this method. |
abstract int |
getInDegree(VertexType v)
Returns in-degree of vertex vertexId, the number of edges which their tail goes to the specified vertex. |
abstract int |
getOutDegree(VertexType v)
Returns out-degree of the supplied vertex, the number of edges which their head is attached to the specified vertex. |
abstract BaseVertex[] |
getVertexArray()
Returns array of vertices upcasted to BaseVertex. |
abstract int |
getVerticesCount()
Returns the number of vertices. |
abstract void |
insertEdge(EdgeType newEdge)
Inserts an edge in the graph. |
abstract void |
insertVertex(VertexType newVertex)
Inserts a new vertex to the graph. |
abstract boolean |
isDirected()
Returns whether the graph is directed. |
abstract boolean |
isEdge(VertexType head,
VertexType tail)
Returns true if there is an edge between specified vertices (direction considered for directed graphs). |
abstract java.util.Iterator<VertexType> |
iterator()
Returns iterator object for the vertices. |
abstract java.util.Iterator<EdgeType> |
lightEdgeIterator()
Returns a light(weight) Edge Iterator object which iterates through all the edges in the graph. |
abstract java.util.Iterator<EdgeType> |
lightEdgeIterator(VertexType v)
Constructs a light(weight) Edge Iterator object which iterates through all the edges going to or coming from the specified vertex v. |
abstract java.util.Iterator<EdgeType> |
lightEdgeIterator(VertexType v,
boolean head)
Constructs a light(weight) Edge Iterator object which iterates through all the edges going to or coming from (depending on the second parameter) the specified vertex v. |
abstract void |
removeAllEdges(VertexType head,
VertexType tail)
Removes all edges between two vertices. |
abstract void |
removeEdge(EdgeType edge)
Removes an edge from the graph. |
abstract void |
removeVertex(VertexType v)
Removes a vertex and all it's connected edges. |
abstract void |
setDirected(boolean isDirected)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BaseGraph()
| Method Detail |
|---|
public abstract int getVerticesCount()
public abstract BaseGraph<VertexType,EdgeType> copy(GraphConverter<EdgeType,EdgeType,VertexType,VertexType> gc)
throws InvalidGraphException
gc - Reference to GraphConverter object.
InvalidGraphException - If the graph is not a valid graph object.
public abstract void insertEdge(EdgeType newEdge)
throws InvalidVertexException
newEdge - Reference to the new edge object.
InvalidVertexException - Thrown when the edge object tries
to connect two vertices whom their indexes are invalid.
public abstract void removeAllEdges(VertexType head,
VertexType tail)
throws InvalidVertexException
head - Index of the edges' start point.tail - Index of the edges' end point.
InvalidVertexException - Thrown when two supplied indexes of vertices are invalid.
public abstract void removeEdge(EdgeType edge)
throws InvalidEdgeException
edge - Edge to be removed.
InvalidEdgeException - If edge is an invalid edge object.
public abstract java.util.Collection<EdgeType> getEdges(VertexType head,
VertexType tail)
throws InvalidVertexException
Head - of the desired edges.Tail - of the desired edges.
InvalidVertexException - if supplied head or tail are invalid.
public abstract boolean isEdge(VertexType head,
VertexType tail)
throws InvalidVertexException
Head - of the edge for existance check.Tail - of the edge for existance check.
InvalidVertexException - if supplied head or tail are invalid.public abstract void insertVertex(VertexType newVertex)
newVertex - The new vertex to be inserted.
public abstract void removeVertex(VertexType v)
throws InvalidVertexException
Vertex - to be removed.
InvalidVertexExceptionpublic abstract java.util.Iterator<VertexType> iterator()
iterator in interface java.lang.Iterable<VertexType extends BaseVertex>
public abstract int getInDegree(VertexType v)
throws InvalidVertexException
InvalidVertexException
public abstract int getOutDegree(VertexType v)
throws InvalidVertexException
InvalidVertexExceptionpublic abstract Jama.Matrix getAdjacencyMatrix()
public abstract boolean isDirected()
public abstract void dump()
public abstract java.util.Iterator<EdgeType> edgeIterator()
public abstract java.util.Iterator<EdgeType> edgeIterator(VertexType v)
throws InvalidVertexException
v.
Note that if the graph object is changed during iteration, the iteration may not
actually represent current state of the graph. For example, if you deleted an edge
after construction of this object, the edge would be included in the iteration.
v - Head or tail of desired edges.
InvalidVertexException
public abstract java.util.Iterator<EdgeType> edgeIterator(VertexType v,
boolean head)
throws InvalidVertexException
v.
If the second parameter it true, then the first parameter is considered to be head of
all desired edges, and if it's false the first parameter is considered to be tail of desired edges.
Note that if the graph object is changed during iteration, the iteration may not
actually represent current state of the graph. For example, if you deleted an edge
after construction of this object, the edge would be included in the iteration.
v - If the second parameter is true indicated the vertex which is head of desired edges, otherwise
it is considered to be tail of desired edges.head - True means the first parameter should be considered head of desired edges.
InvalidVertexExceptionpublic abstract boolean containsVertex(VertexType v)
v - Vertex to check existance.
public abstract void checkVertex(VertexType v)
throws InvalidVertexException
v - The vertex to be checked.
InvalidVertexException - If the supplied vertex is invalid.public abstract BaseGraph<VertexType,EdgeType> createEmptyGraph()
public abstract BaseVertex[] getVertexArray()
public abstract int[][] getEdgeArray()
public abstract java.util.Iterator<EdgeType> lightEdgeIterator()
public abstract java.util.Iterator<EdgeType> lightEdgeIterator(VertexType v)
throws InvalidVertexException
v.
The light(weight) edge iterator presents an iterator with O(1) constructor. Note that you should
not change the content of the graph during your iteration. You can still change properties of
each edge or vertex.
v - Head or tail of desired edges.
InvalidVertexException
public abstract java.util.Iterator<EdgeType> lightEdgeIterator(VertexType v,
boolean head)
throws InvalidVertexException
v.
If the second parameter it true, then the first parameter is considered to be head of
all desired edges, and if it's false the first parameter is considered to be tail of desired edges.
The light(weight) edge iterator presents an iterator with O(1) constructor. Note that you should
not change the content of the graph during your iteration. You can still change properties of
each edge or vertex.
v - If the second parameter is true indicated the vertex which is head of desired edges, otherwise
it is considered to be tail of desired edges.head - True means the first parameter should be considered head of desired edges.
InvalidVertexExceptionpublic abstract void clear()
public abstract void setDirected(boolean isDirected)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||