Class Graph.Vertex<V,E>
java.lang.Object
Graph.Vertex<V,E>
A holder class for Vertices that allows each Vertex to track all incident
edges and adjacent vertices, as well as store a data entry associated with
the vertex.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionedgesIn()Returns the collection of edges entering this vertex.edgesOut()Returns the collection of edges leaving this vertex.Graph.Edge<V,E> getEdgeFrom(Graph.Vertex<V, E> other) Returns the edge from the vertex specified byotherto this vertex.Graph.Edge<V,E> getEdgeTo(Graph.Vertex<V, E> other) Returns the edge from this vertex to the vertex specified byother.Returns the collection of vertices who can reach this vertex by a single edge.Returns the collection of vertices reachable from this vertex by a single edge.toString()
-
Field Details
-
data
The data associated with this vertex.
-
-
Constructor Details
-
Vertex
public Vertex()Constructs a vertex without any data. -
Vertex
Constructs a vertex with the specified data.- Parameters:
data- the data to be stored within this vertex
-
-
Method Details
-
toString
-
getEdgeTo
Returns the edge from this vertex to the vertex specified byother. If no such edge exists, returnsnull.- Parameters:
other- the other endpoint of the edge to be returned- Returns:
- the edge from this vertex to the vertex specified by
other. If no such edge exists, returnsnull.
-
getEdgeFrom
Returns the edge from the vertex specified byotherto this vertex. If no such edge exists, returnsnull.- Parameters:
other- the other endpoint of the edge to be returned- Returns:
- the edge from the vertex specified by
otherto this vertex. If no such edge exists, returnsnull.
-
neighborsOut
Returns the collection of vertices reachable from this vertex by a single edge.- Returns:
- the collection of vertices reachable from this vertex by a single edge.
-
neighborsIn
Returns the collection of vertices who can reach this vertex by a single edge.- Returns:
- the collection of vertices who can reach this vertex by a single edge.
-
edgesOut
Returns the collection of edges leaving this vertex.- Returns:
- the collection of edges leaving this vertex.
-
edgesIn
Returns the collection of edges entering this vertex.- Returns:
- the collection of edges entering this vertex.
-