| Modifier and Type | Class and Description |
|---|---|
class |
Vertex.EdgeIteratorWrapper |
class |
Vertex.NeighborIteratorWrapper |
| Modifier and Type | Method and Description |
|---|---|
Edge |
addEdge(Vertex vertex)
Attaches a new
Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
float weight)
Attaches a new
Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
int color)
Attaches a new
Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
int color,
float weight)
Attaches a new
Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
java.lang.String label)
Attaches a new
Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
java.lang.String label,
int color)
Attaches a new
Edge between this
Vertex and the specified one. |
Edge |
addEdge(Vertex vertex,
java.lang.String label,
int color,
float weight)
Attaches a new
Edge between this
Vertex and the specified one. |
int |
compareTo(java.lang.Object o)
Defined in
Comparable. |
java.util.Iterator<Edge> |
edgeIterator()
Returns an
Iterator over the Edges attached
to this Vertex. |
java.lang.Iterable<Edge> |
edges()
Returns an
java.util.Iterable over this Vertex's
Edges that can be used in a foreach construct. |
int |
getColor()
Gets this Vertex's color.
|
Edge |
getEdge(Vertex destination)
Returns the edge from this Vertex to the specified one
or null if one doesn't exist.
|
int |
getIndex()
Gets this Vertex's index.
|
java.lang.String |
getLabel()
Gets this Vertex's label.
|
float |
getWeight()
Gets this Vertex's weight.
|
boolean |
isAdjacent(Vertex vertex)
Determines if the specified Vertex is adjacent to this one
(whether they are connected with an Edge.)
|
java.util.Iterator<Edge> |
iterator()
Returns an
Iterator over the Edges attached
to this Vertex. |
java.util.Iterator<Vertex> |
neighborIterator()
Returns an
Iterator over this Vertex's
neighbors. |
java.lang.Iterable<Vertex> |
neighbors()
Returns an
java.util.Iterable over this Vertex's
neighbors that can be used in a foreach construct. |
boolean |
removeEdge(Edge edge)
Removes the specified Edge.
|
void |
removeEdges()
Removes all the Edges attached to this Vertex.
|
int |
setColor(int color)
Sets this Vertex's color.
|
int |
setIndex(int index)
Sets this Vertex's index.
|
java.lang.String |
setLabel(java.lang.String label)
Sets this Vertex's label.
|
float |
setWeight(float weight)
Sets this Vertex's weight.
|
java.lang.String |
toString()
Returns a String representation of this Vertex.
|
java.lang.String |
toString(boolean neighborsToo)
Returns a String representation of this Vertex and optionally
its neighbors and their connecting Edges.
|
public java.lang.String getLabel()
public java.lang.String setLabel(java.lang.String label)
label - the new label for this Vertex.public int getColor()
public int setColor(int color)
color - the new color for this Vertexpublic int getIndex()
public int setIndex(int index)
index - the new index for this Vertexpublic float getWeight()
public float setWeight(float weight)
weight - the new weight for this Vertexpublic int compareTo(java.lang.Object o)
Comparable.compareTo in interface java.lang.Comparablepublic Edge addEdge(Vertex vertex, java.lang.String label, int color, float weight)
Edge between this
Vertex and the specified one.vertex - the endpoint of the new Edgelabel - the label for the new Edgecolor - the color for the new Edgeweight - the weight for the new EdgeGraphException - if color is negative,DiGraph and the endpoint
is this Vertexpublic Edge addEdge(Vertex vertex, java.lang.String label, int color)
Edge between this
Vertex and the specified one.vertex - the endpoint of the new Edgelabel - the label for the new Edgecolor - the color for the new EdgeGraphException - if color is negative,DiGraph and the endpoint
is this Vertexpublic Edge addEdge(Vertex vertex, java.lang.String label)
Edge between this
Vertex and the specified one.vertex - the endpoint of the new Edgelabel - the label for the new EdgeGraphException - if destination vertex is null,
DiGraph and the endpoint
is this Vertexpublic Edge addEdge(Vertex vertex)
Edge between this
Vertex and the specified one.vertex - the endpoint of the new EdgeGraphException - if destination vertex is null,
DiGraph and the endpoint
is this Vertexpublic Edge addEdge(Vertex vertex, int color, float weight)
Edge between this
Vertex and the specified one.vertex - the endpoint of the new Edgecolor - the color for the new Edgeweight - the weight for the new EdgeGraphException - if color is negative,DiGraph and the endpoint
is this Vertexpublic Edge addEdge(Vertex vertex, int color)
Edge between this
Vertex and the specified one.vertex - the endpoint of the new Edgecolor - the color for the new EdgeGraphException - if color is negative,DiGraph and the endpoint
is this Vertexpublic Edge addEdge(Vertex vertex, float weight)
Edge between this
Vertex and the specified one.vertex - the endpoint of the new Edgeweight - the weight for the new EdgeGraphException - if destination vertex is null,
DiGraph and the endpoint
is this Vertexpublic Edge getEdge(Vertex destination)
destination - the Vertex and Edge leading to
which is sought.public java.util.Iterator<Edge> iterator()
Iterator over the Edges attached
to this Vertex.iterator in interface java.lang.Iterablepublic java.util.Iterator<Edge> edgeIterator()
Iterator over the Edges attached
to this Vertex.public java.lang.Iterable<Edge> edges()
java.util.Iterable over this Vertex's
Edges that can be used in a foreach construct.public java.lang.Iterable<Vertex> neighbors()
java.util.Iterable over this Vertex's
neighbors that can be used in a foreach construct.public java.util.Iterator<Vertex> neighborIterator()
Iterator over this Vertex's
neighbors.public void removeEdges()
public boolean removeEdge(Edge edge)
edge - the Edge to removepublic boolean isAdjacent(Vertex vertex)
vertex - the Vertex to checkpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(boolean neighborsToo)
neighborsToo - whether to recursively include the neighbours
and the connecting Edges