Class AdjacencyListWriter

java.lang.Object
org.jhotdraw8.graph.io.AdjacencyListWriter

public class AdjacencyListWriter extends Object
Writes a graph as an adjacency list.
  • Constructor Details

    • AdjacencyListWriter

      public AdjacencyListWriter()
      Creates a new instance.
  • Method Details

    • write

      public <V, A> String write(@NonNull DirectedGraph<V,A> graph)
      Dumps the graph for debugging purposes.
      Type Parameters:
      V - the vertex data type
      A - 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 IOException
      Dumps the graph for debugging purposes.
      Type Parameters:
      V - the vertex data type
      A - the arrow data type
      Parameters:
      w - the writer
      graph - 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,String> toStringFunction) throws IOException
      Dumps the graph for debugging purposes.
      Type Parameters:
      V - the vertex data type
      A - the arrow data type
      Parameters:
      w - the writer
      graph - the graph to be dumped
      toStringFunction - a function which converts a vertex to a string
      Throws:
      IOException - if writing fails