Class DotGenerator
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.base.itc.graphimpl.DotGenerator
-
public class DotGenerator extends java.lang.Object
This class contains utility methods to generate dot representations forGraph
instances.- Since:
- 2.3
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <V> java.lang.String
generateDot(Graph<V> graph)
Generates the dot representation for the given graph.static <V> java.lang.String
generateDot(Graph<V> graph, boolean colorSCCs, java.util.function.Function<V,java.lang.String> nameFunction, java.util.function.Function<V,java.lang.String> colorFunction, java.util.function.Function<V,java.util.function.Function<V,java.lang.String>> edgeFunction)
Generates the dot representation for the given graph.static <V> java.util.function.Function<V,java.lang.String>
getNameShortener(int maxLength)
Returns a simple name shortener function that can be used in the graphviz visualization to help with readability.
-
-
-
Method Detail
-
generateDot
public static <V> java.lang.String generateDot(Graph<V> graph, boolean colorSCCs, java.util.function.Function<V,java.lang.String> nameFunction, java.util.function.Function<V,java.lang.String> colorFunction, java.util.function.Function<V,java.util.function.Function<V,java.lang.String>> edgeFunction)
Generates the dot representation for the given graph.- Parameters:
graph
- the graphcolorSCCs
- specifies if the strongly connected components with size greater than shall be colorednameFunction
- use this function to provide custom names to nodes, null if the default toString shall be usedcolorFunction
- use this function to provide custom color to nodes, null if the default white color shall be usededgeFunction
- 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> java.lang.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> java.util.function.Function<V,java.lang.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 theNode
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
-
-