Package soot.util.dot

Class DotGraph

  • All Implemented Interfaces:
    Renderable

    public class DotGraph
    extends AbstractDotGraphElement
    implements Renderable
    Allow a serialized drawing, following steps:
    1. new DotGraph
    2. draw(Directed/Undirected)Edge, attachAttributes, addNode
    3. plot
    • Field Detail

      • DOT_EXTENSION

        public static final String DOT_EXTENSION
        The extension added to output files, exported so that clients can search for the filenames.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DotGraph

        public DotGraph​(String graphname)
        Creates a new graph for drawing.
        Parameters:
        graphname - , the name used to identify the graph in the dot source.
    • Method Detail

      • plot

        public void plot​(String filename)
        Generates the drawing on canvas to the dot file.
        Parameters:
        filename - the name for the output file. By convention, it should end with DOT_EXTENSION, but this is not enforced.
      • drawEdge

        public DotGraphEdge drawEdge​(String from,
                                     String to)
        Draws a directed edge (including the source and end nodes, if they have not already been drawn).
        Parameters:
        from - , the source node
        to - , the end node
        Returns:
        a directed graph edge connecting from with to
      • drawUndirectedEdge

        public DotGraphEdge drawUndirectedEdge​(String node1,
                                               String node2)
        Draws a undirected edge (including the nodes, if they have not already been drawn).
        Parameters:
        node1 -
        node2 -
        Returns:
        an undirected graph edge connecting node1 with node2
      • drawNode

        public DotGraphNode drawNode​(String name)
        Draws a node.
        Parameters:
        name - , the node to draw.
        Returns:
        the DotGraphNode corresponding to the specified name.
      • getNode

        public DotGraphNode getNode​(String name)
        Gets the graph node by name.
        Parameters:
        name - , unique name of the node.
        Returns:
        the node with the specified name, adding a new node to the graph if there is no such node.
      • containsNode

        public boolean containsNode​(String name)
        Checks if the graph already contains the node with the specified name.
        Parameters:
        name - , unique name of the node.
        Returns:
        true if the node with the specified name is already in the graph, false otherwise
      • containsNode

        public boolean containsNode​(DotGraphNode node)
        Checks if the graph already contains the given DotGraphNode.
        Parameters:
        node -
        Returns:
        true if the node is already in the graph, false otherwise
      • quoteNodeNames

        public void quoteNodeNames​(boolean value)
        NOTE: default is true
        Parameters:
        value -
      • setNodeShape

        public void setNodeShape​(String shape)
        Sets all node shapes, see the list of node shapes in DotGraphConstants.
        Parameters:
        shape - , the node shape
      • setNodeStyle

        public void setNodeStyle​(String style)
        Sets all node styles
        Parameters:
        style - , the node style
      • setGraphSize

        public void setGraphSize​(double width,
                                 double height)
        sets the size of drawing area, in inches
      • setPageSize

        public void setPageSize​(double width,
                                double height)
        sets the pages size, once this is set, the generated graph will be broken into several pages.
      • setOrientation

        public void setOrientation​(String orientation)
        sets the graph rotation angles
      • setGraphName

        public void setGraphName​(String name)
        sets the graph name
      • createSubGraph

        public DotGraph createSubGraph​(String label)
        creates a sub graph. NOTE: Some renderers require subgraph labels to start with "cluster".
        Returns:
        the newly created sub graph.