|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.mhhe.clrs2e.Vertex
A class for vertices in graphs. Every vertex has a name and an index in its graph.
Graph,
AdjacencyListGraph,
AdjacencyMatrixGraph,
WeightedAdjacencyListGraph,
WeightedAdjacencyMatrixGraph,
FlowNetwork| Field Summary | |
private int |
index
Index of this vertex in its graph, 0 to cardV-1. |
private java.lang.String |
name
This vertex's name. |
static int |
UNKNOWN_INDEX
Value that indicates that this vertex does not yet have an index, i.e., the index is unknown. |
| Constructor Summary | |
Vertex(int index,
java.lang.String name)
Creates a vertex with a given index and name. |
|
Vertex(java.lang.String name)
Creates a vertex whose index is unknown. |
|
| Method Summary | |
int |
getIndex()
Returns this vertex's index. |
java.lang.String |
getName()
Returns this vertex's name. |
void |
setIndex(int index)
Sets this vertex's index. |
void |
setName(java.lang.String name)
Sets this vertex's name. |
java.lang.String |
toString()
Returns the String representation of this
vertex. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int UNKNOWN_INDEX
private int index
private java.lang.String name
| Constructor Detail |
public Vertex(java.lang.String name)
name - This vertex's name.
public Vertex(int index,
java.lang.String name)
index - This vertex's index.name - This vertex's name.| Method Detail |
public void setIndex(int index)
index - New value for this vertex's index.public int getIndex()
public void setName(java.lang.String name)
name - New value for this vertex's name.public java.lang.String getName()
public java.lang.String toString()
String representation of this
vertex.
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||