Class DiGraphs

java.lang.Object
it.unimi.di.prog2.h25.digraph.DiGraphs

public class DiGraphs extends Object
A collection of utilities related to DiGraphs.

This class provides a few utility methods, mainly related to Graphviz.

  • Constructor Details

    • DiGraphs

      private DiGraphs()
  • Method Details

    • fromAdjacencyMap

      public static <T> void fromAdjacencyMap(Map<T,Collection<T>> adjacency, DiGraph<T> graph)
    • toDot

      public static <T> String toDot(DiGraph<T> g)
      Returns the dot representation of the given graph.
      Type Parameters:
      T - the type of the graph nodes.
      Parameters:
      g - the graph.
      Returns:
      the dot representation of the given graph.
    • toDot

      public static <T> String toDot(DiGraph<T> g, String extra)
      Returns the dot representation of the given graph.
      Type Parameters:
      T - the type of the graph nodes.
      Parameters:
      g - the graph.
      extra - extra configuration to be added to the dot source.
      Returns:
      the dot representation of the given graph.
    • dotToPdf

      public static void dotToPdf(String dot, String path)
      Renders a dot source to a PDF file (invoking an external command).
      Parameters:
      dot - the dot source
      path - path of the PDF to create.