public class Vertex<L extends java.lang.Comparable<L>,V>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.TreeMap<L,Vertex<L,V>> |
edges |
protected L |
label |
protected java.util.Set<V> |
values |
| Constructor and Description |
|---|
Vertex() |
Vertex(L label) |
Vertex(L label,
java.util.Collection<V> values) |
Vertex(L label,
V value) |
Vertex(Vertex<L,V> v) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPath(java.util.Iterator<Vertex<L,V>> path)
Add and connect a collection of vertices in the form of a traversal path.
|
void |
addValue(V value) |
void |
addValues(java.util.Collection<V> values) |
void |
clearEdges()
Removes all the edges from this Vertex, severing any connections with
neighboring vertices.
|
void |
clearValues()
Clears all values associated with this Vertex.
|
Vertex<L,V> |
connect(Vertex<L,V> vertex)
Connnects two vertices.
|
boolean |
connectedTo(L label)
Determines if two vertices are connected.
|
java.util.List<Path<L,V>> |
descendantPaths()
Retrieves all
Path instances represented by the children of this
Vertex. |
java.util.Collection<Vertex<L,V>> |
getAllNeighbors()
Traverse all edges to return all neighboring vertices.
|
L |
getLabel() |
Vertex<L,V> |
getNeighbor(L label)
Retrieve a neighboring Vertex.
|
java.util.Set<L> |
getNeighborLabels()
Retrieve the labels of all neighboring vertices.
|
java.util.NavigableMap<L,Vertex<L,V>> |
getNeighborsGreaterThan(L label,
boolean inclusive) |
java.util.NavigableMap<L,Vertex<L,V>> |
getNeighborsLessThan(L label,
boolean inclusive) |
java.util.Set<V> |
getValues() |
long |
numDescendantEdges()
Retrieves the number of descendant edges for this
Vertex. |
long |
numDescendants()
Retrieves the number of descendant vertices for this
Vertex. |
void |
setLabel(L label) |
java.lang.String |
toString() |
protected java.lang.String |
toString(int indent)
Pretty-print this vertex (and its children) with a given indent level.
|
protected void |
traverseDescendants(Vertex<L,V> vertex,
java.util.List<Path<L,V>> paths,
Path<L,V> currentPath)
Traverses through descendant Vertices, finding Path instances.
|
protected java.util.Set<V> values
public Vertex()
public Vertex(L label)
public boolean connectedTo(L label)
public Vertex<L,V> getNeighbor(L label)
label - Neighbor's label.public java.util.NavigableMap<L,Vertex<L,V>> getNeighborsLessThan(L label, boolean inclusive)
public java.util.NavigableMap<L,Vertex<L,V>> getNeighborsGreaterThan(L label, boolean inclusive)
public java.util.Set<L> getNeighborLabels()
public java.util.Collection<Vertex<L,V>> getAllNeighbors()
public Vertex<L,V> connect(Vertex<L,V> vertex)
vertex - The vertex to connect to.public void addPath(java.util.Iterator<Vertex<L,V>> path)
public L getLabel()
public void setLabel(L label)
public java.util.Set<V> getValues()
public void addValue(V value)
public void addValues(java.util.Collection<V> values)
public java.util.List<Path<L,V>> descendantPaths()
Path instances represented by the children of this
Vertex.protected void traverseDescendants(Vertex<L,V> vertex, java.util.List<Path<L,V>> paths, Path<L,V> currentPath)
vertex - Vertex to query descendantspaths - List of Paths discovered thus far during traversal. This is
updated as new Path instances are found.currentPath - The current Path being inspected by the traversalpublic long numDescendants()
Vertex.public long numDescendantEdges()
Vertex. This
count includes the links between descendants for scan operations.public void clearEdges()
public void clearValues()
protected java.lang.String toString(int indent)
public java.lang.String toString()
toString in class java.lang.Object