Class DotGenerator

java.lang.Object
tools.refinery.interpreter.rete.itc.graphimpl.DotGenerator

public class DotGenerator extends Object
This class contains utility methods to generate dot representations for Graph instances.
Since:
2.3
  • Method Details

    • generateDot

      public static <V> String generateDot(Graph<V> graph, boolean colorSCCs, Function<V,String> nameFunction, Function<V,String> colorFunction, Function<V,Function<V,String>> edgeFunction)
      Generates the dot representation for the given graph.
      Parameters:
      graph - the graph
      colorSCCs - specifies if the strongly connected components with size greater than shall be colored
      nameFunction - use this function to provide custom names to nodes, null if the default toString shall be used
      colorFunction - use this function to provide custom color to nodes, null if the default white color shall be used
      edgeFunction - use this function to provide custom edge labels, null if no edge label shall be printed
      Returns:
      the dot representation as a string
    • generateDot

      public static <V> String generateDot(Graph<V> graph)
      Generates the dot representation for the given graph. No special pretty printing customization will be applied.
      Parameters:
      graph - the graph
      Returns:
      the dot representation as a string
    • getNameShortener

      public static <V> Function<V,String> getNameShortener(int maxLength)
      Returns a simple name shortener function that can be used in the graphviz visualization to help with readability. WARNING: if you shorten the name of the
      invalid reference
      Node
      s too much, the visualization may become incorrect because grahpviz will treat different nodes as the same if their shortened names are the same.
      Parameters:
      maxLength - the maximum length of the text that is kept from the toString of the objects in the graph
      Returns:
      the shrunk toString value