- Type Parameters:
V- the vertex data typeA- the arrow data type
- All Superinterfaces:
BareDirectedGraph<V,,A> BareDirectedVertexGraph<V>
- All Known Subinterfaces:
BidiGraph<V,,A> MutableBidiGraph<V,,A> MutableDirectedGraph<V,A>
- All Known Implementing Classes:
ImmutableAttributed16BitIndexedDirectedGraph,ImmutableAttributed32BitIndexedBidiGraph,ImmutableAttributed32BitIndexedDirectedGraph,IndexedBidiGraphBidiGraphFacade,IndexedDirectedGraphDirectedGraphFacade,SimpleMutableBidiGraph,SimpleMutableDirectedGraph
Adds convenience methods to the interface defined in
BareDirectedGraph.- Author:
- Werner Randelshofer
-
Method Summary
Modifier and TypeMethodDescriptionReturns the arrow data for the arrow going fromutovif the arrow exists.default intfindIndexOfNext(@NonNull V v, @NonNull V u) Returns the index of vertexuin the list of next vertices ofvif an arrow fromvtouexists.intReturns the number of arrows.default @NonNull Collection<A> Returns all arrows.default @NonNull Collection<A> Returns all arrows between two vertices.getNextArc(@NonNull V v, int i) Returns the arc data for thei-th next (outgoing) arrow from vertexv.default @NonNull Collection<Arc<V, A>> getNextArcs(@NonNull V v) Returns the list of next arc data of vertexv.default @NonNull Collection<A> Returns the list of next arrow data of vertexv.default @NonNull Collection<V> Returns the list of next vertices of vertexv.getVertex(int index) Gets the vertex data at the specified index.default intReturns the number of vertices.default booleanReturns true if there is an arrow from vertexvto vertexu.default @NonNull Enumerator<V> searchNextVertices(@NonNull V start, boolean dfs) Searches for vertices starting at the provided vertex.default @NonNull Enumerator<V> Searches for vertices starting at the provided vertex.Methods inherited from interface org.jhotdraw8.graph.BareDirectedGraph
getNextArrowMethods inherited from interface org.jhotdraw8.graph.BareDirectedVertexGraph
getNext, getNextCount, getVertices
-
Method Details
-
findArrow
Returns the arrow data for the arrow going fromutovif the arrow exists.- Parameters:
u- a vertexv- a vertex- Returns:
- the arrow data or null
-
findIndexOfNext
Returns the index of vertexuin the list of next vertices ofvif an arrow fromvtouexists.- Parameters:
v- a vertexu- a vertex- Returns:
- index of vertex
uor a value < 0
-
getNextVertices
Returns the list of next vertices of vertexv.- Parameters:
v- a vertex- Returns:
- a collection view on the direct successor vertices of vertex
-
getNextArc
Returns the arc data for thei-th next (outgoing) arrow from vertexv.- Parameters:
v- a vertexi- the index into the list of outgoing arrows- Returns:
- the arc data
-
getNextArrows
Returns the list of next arrow data of vertexv.- Parameters:
v- a vertex- Returns:
- a collection view on the arrow data
-
getNextArcs
Returns the list of next arc data of vertexv.- Parameters:
v- a vertex- Returns:
- a collection view on the arc data
-
getVertexCount
default int getVertexCount()Returns the number of vertices.- Returns:
- vertex count
-
getArrowCount
int getArrowCount()Returns the number of arrows.- Returns:
- arrow count
-
getArrows
Returns all arrows between two vertices.- Parameters:
v1- vertex 1v2- vertex 2- Returns:
- a collection of all arrows
-
getArrows
Returns all arrows.- Returns:
- a collection of all arrows
-
isNext
Returns true if there is an arrow from vertexvto vertexu.- Parameters:
v- a vertexu- a vertex- Returns:
- true if
uis next ofv
-
getVertex
Gets the vertex data at the specified index.- Parameters:
index- an index- Returns:
- vertex data
- Throws:
IndexOutOfBoundsException- if the index is out of bounds
-
searchNextVertices
Searches for vertices starting at the provided vertex.- Parameters:
start- the start vertexdfs- whether to search depth-first instead of breadth-first- Returns:
- breadth first search
-
searchNextVertices
default @NonNull Enumerator<V> searchNextVertices(@NonNull V start, @NonNull AddToSet<V> visited, boolean dfs) Searches for vertices starting at the provided vertex.- Parameters:
start- the start vertexvisited- the add method of the visited set, seeSet.add(E).dfs- whether to search depth-first instead of breadth-first- Returns:
- breadth first search
-