public class EdgeWeightedDigraph extends java.lang.Object
For additional documentation, see Section 4.4 of Algorithms, 4th Edition, by Robert Sedgewick and Kevin Wayne.
Constructor and Description |
---|
EdgeWeightedDigraph(EdgeWeightedDigraph G)
Copy constructor.
|
EdgeWeightedDigraph(In in)
Create an edge-weighted digraph from input stream.
|
EdgeWeightedDigraph(int V)
Create an empty edge-weighted digraph with V vertices.
|
EdgeWeightedDigraph(int V,
int E)
Create a edge-weighted digraph with V vertices and E edges.
|
Modifier and Type | Method and Description |
---|---|
void |
addEdge(DirectedEdge e)
Add the directed edge e to this digraph.
|
java.lang.Iterable<DirectedEdge> |
adj(int v)
Return the edges incident from vertex v as an Iterable.
|
int |
E()
Return the number of edges in this digraph.
|
java.lang.Iterable<DirectedEdge> |
edges()
Return all edges in this digraph as an Iterable.
|
static void |
main(java.lang.String[] args)
Test client.
|
int |
outdegree(int v)
Return number of edges incident from v.
|
java.lang.String |
toString()
Return a string representation of this digraph.
|
int |
V()
Return the number of vertices in this digraph.
|
public EdgeWeightedDigraph(int V)
public EdgeWeightedDigraph(int V, int E)
public EdgeWeightedDigraph(In in)
public EdgeWeightedDigraph(EdgeWeightedDigraph G)
public int V()
public int E()
public void addEdge(DirectedEdge e)
public java.lang.Iterable<DirectedEdge> adj(int v)
public java.lang.Iterable<DirectedEdge> edges()
public int outdegree(int v)
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)