dataStructures
Class LinkedDigraph
java.lang.Object
|
+--dataStructures.Graph
|
+--dataStructures.LinkedDigraph
- Direct Known Subclasses:
- LinkedGraph, LinkedWDigraph
- public class LinkedDigraph
- extends Graph
Method Summary |
void |
bfs(int v,
int[] reach,
int label)
breadth-first search |
int |
degree(int i)
this method is undefined for directed graphs |
int |
edges()
|
boolean |
existsEdge(int i,
int j)
|
int |
inDegree(int i)
|
java.util.Iterator |
iterator(int i)
create and return an iterator for vertex i |
static void |
main(java.lang.String[] args)
test program |
int |
outDegree(int i)
|
void |
output()
output the graph |
void |
putEdge(java.lang.Object theEdge)
put theEdge into the digraph |
void |
removeEdge(int i,
int j)
remove the edge (i,j) |
int |
vertices()
|
Methods inherited from class dataStructures.Graph |
bellmanFord,
bipartiteCover,
connected,
dfs,
findPath,
kruskal,
labelComponents,
topologicalOrder,
verifyDirected,
verifyUndirected,
verifyWeighted,
verifyWeightedUndirected |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
LinkedDigraph
public LinkedDigraph(int theVertices)
LinkedDigraph
public LinkedDigraph()
vertices
public int vertices()
- Returns:
- number of vertices
- Overrides:
- vertices in class Graph
edges
public int edges()
- Returns:
- number of edges
- Overrides:
- edges in class Graph
existsEdge
public boolean existsEdge(int i,
int j)
- Returns:
- true iff (i,j) is an edge
- Overrides:
- existsEdge in class Graph
putEdge
public void putEdge(java.lang.Object theEdge)
- put theEdge into the digraph
- Throws:
- java.lang.IllegalArgumentException - when
theEdge is invalid
- Overrides:
- putEdge in class Graph
removeEdge
public void removeEdge(int i,
int j)
- remove the edge (i,j)
- Overrides:
- removeEdge in class Graph
degree
public int degree(int i)
- this method is undefined for directed graphs
- Throws:
- NoSuchMethodError -
- Overrides:
- degree in class Graph
outDegree
public int outDegree(int i)
- Returns:
- out-degree of vertex i
- Throws:
- java.lang.IllegalArgumentException - when
i is an invalid vertex
- Overrides:
- outDegree in class Graph
inDegree
public int inDegree(int i)
- Returns:
- in-degree of vertex i
- Throws:
- java.lang.IllegalArgumentException - when
i is an invalid vertex
- Overrides:
- inDegree in class Graph
output
public void output()
- output the graph
iterator
public java.util.Iterator iterator(int i)
- create and return an iterator for vertex i
- Throws:
- java.lang.IllegalArgumentException - when
i is an invalid vertex
- Overrides:
- iterator in class Graph
bfs
public void bfs(int v,
int[] reach,
int label)
- breadth-first search
- Overrides:
- bfs in class Graph
main
public static void main(java.lang.String[] args)
- test program