java.lang.Object
org.jhotdraw8.graph.io.AdjacencyListWriter
Writes a graph as an adjacency list.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<V,A> void write(@NonNull Appendable w, @NonNull DirectedGraph<V, A> graph) Dumps the graph for debugging purposes.<V,A> void write(@NonNull Appendable w, @NonNull DirectedGraph<V, A> graph, @NonNull Function<V, String> toStringFunction) Dumps the graph for debugging purposes.<V,A> String write(@NonNull DirectedGraph<V, A> graph) Dumps the graph for debugging purposes.
-
Constructor Details
-
AdjacencyListWriter
public AdjacencyListWriter()Creates a new instance.
-
-
Method Details
-
write
Dumps the graph for debugging purposes.- Type Parameters:
V- the vertex data typeA- the arrow data type- Parameters:
graph- the graph to be dumped- Returns:
- the dump
-
write
public <V,A> void write(@NonNull Appendable w, @NonNull DirectedGraph<V, A> graph) throws IOExceptionDumps the graph for debugging purposes.- Type Parameters:
V- the vertex data typeA- the arrow data type- Parameters:
w- the writergraph- the graph to be dumped- Throws:
IOException- if writing fails
-
write
public <V,A> void write(@NonNull Appendable w, @NonNull DirectedGraph<V, A> graph, @NonNull Function<V, throws IOExceptionString> toStringFunction) Dumps the graph for debugging purposes.- Type Parameters:
V- the vertex data typeA- the arrow data type- Parameters:
w- the writergraph- the graph to be dumpedtoStringFunction- a function which converts a vertex to a string- Throws:
IOException- if writing fails
-