|
GraphLab Project | |||||||||
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.
Field Summary | |
---|---|
protected boolean |
isSubgraph
Whether the graph is a subgraph. |
protected int |
lastSubgraphIndex
|
protected int |
subgraphIndex
If zero, indicates that the graph is not a subgraph. |
protected BaseGraph<VertexType,EdgeType> |
superGraph
|
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(EdgeVertexCopier<VertexType,EdgeType> 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
|
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 . |
|
java.lang.Iterable<EdgeType> |
edges()
|
|
abstract Matrix |
getAdjacencyMatrix()
Returns a Jama Matrix object that represents adjacency matrix of the graph. |
|
int |
getDegree(VertexType vertex)
Returns degree of vertex, the number of edges which their target or source is the specified vertex. |
|
abstract int[][] |
getEdgeArray()
Returns array of array of 'int's where represents a simple adjacency list. |
|
java.lang.Iterable<EdgeType> |
getEdges()
Its the same as edges |
|
abstract java.util.AbstractList<EdgeType> |
getEdges(VertexType source,
VertexType target)
Returns a collection of all edges which connects two vertices supplied as first and second arguments of this method. |
|
abstract int |
getEdgesCount()
|
|
protected int |
getId(VertexType v)
A wrapper for getting vertex Id's which supports multiple vertex owners. |
|
abstract int |
getInDegree(VertexType v)
Returns in-degree of vertex vertexId, the number of edges which their target goes to the specified vertex. |
|
java.lang.Iterable<VertexType> |
getNeighbors(VertexType vertex)
|
|
int |
getNewSubgraphIndex()
Get new id for a new subgraph; |
|
abstract int |
getOutDegree(VertexType v)
Returns out-degree of the supplied vertex, the number of edges which their source 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 source,
VertexType target)
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 . |
|
void |
registerSubgraph(BaseGraph<VertexType,EdgeType> superGraph)
Sets the graph as a subgraph. |
|
abstract void |
removeAllEdges(VertexType source,
VertexType target)
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)
|
|
void |
setSubGraphIndex(int i)
Set's the subgraph index. |
|
java.lang.Iterable<VertexType> |
vertices()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int subgraphIndex
subgraphId
.
protected boolean isSubgraph
protected int lastSubgraphIndex
protected BaseGraph<VertexType extends BaseVertex,EdgeType extends BaseEdge<VertexType>> superGraph
Constructor Detail |
---|
public BaseGraph()
Method Detail |
---|
public abstract int getVerticesCount()
public abstract BaseGraph<VertexType,EdgeType> copy(EdgeVertexCopier<VertexType,EdgeType> gc) throws InvalidGraphException
gc
- Reference to EdgeVertexCopier 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 source, VertexType target) throws InvalidVertexException
source
- Index of the edges' start point.target
- 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.AbstractList<EdgeType> getEdges(VertexType source, VertexType target) throws InvalidVertexException
Source
- of the desired edges.Target
- of the desired edges.
InvalidVertexException
- if supplied source or target are invalid.public abstract boolean isEdge(VertexType source, VertexType target) throws InvalidVertexException
Source
- of the edge for existance check.Target
- of the edge for existance check.
InvalidVertexException
- if supplied source or target 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.
InvalidVertexException
public abstract java.util.Iterator<VertexType> iterator()
iterator
in interface java.lang.Iterable<VertexType extends BaseVertex>
public abstract int getInDegree(VertexType v) throws InvalidVertexException
InvalidVertexException
getDegree(BaseVertex)
public abstract int getOutDegree(VertexType v) throws InvalidVertexException
InvalidVertexException
getDegree(BaseVertex)
public abstract Matrix getAdjacencyMatrix()
public abstract boolean isDirected()
public abstract void dump()
public abstract java.util.Iterator<EdgeType> edgeIterator()
lightEdgeIterator()
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
- Source or target of desired edges.
InvalidVertexException
lightEdgeIterator(BaseVertex)
,
getNeighbors(BaseVertex)
public 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 <GraphType extends BaseGraph<VertexType,EdgeType>> GraphType 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
- Source or target of desired edges.
InvalidVertexException
public abstract void clear()
public abstract void setDirected(boolean isDirected)
public void registerSubgraph(BaseGraph<VertexType,EdgeType> superGraph)
b
- public int getNewSubgraphIndex()
b
- public void setSubGraphIndex(int i)
i
- the subgraph index.protected int getId(VertexType v)
v
- Vertex which the caller intends to get its Id.
public abstract int getEdgesCount()
public java.lang.Iterable<EdgeType> edges()
lightEdgeIterator()
public int getDegree(VertexType vertex)
vertex
- public java.lang.Iterable<VertexType> getNeighbors(VertexType vertex)
vertex
-
lightEdgeIterator(BaseVertex)
public java.lang.Iterable<EdgeType> getEdges()
public java.lang.Iterable<VertexType> vertices()
|
GraphLab Project | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |