Package weka.gui.graphvisualizer

# Class DotParser

java.lang.Object
weka.gui.graphvisualizer.DotParser

All Implemented Interfaces:
  `GraphConstants`

public class DotParser extends Object implements GraphConstants
This class parses input in DOT format, and builds the datastructures that are passed to it. It is NOT 100% compatible with the DOT format. The GraphNode and GraphEdge classes do not have any provision for dealing with different colours or shapes of nodes, there can however, be a different label and ID for a node. It also does not do anything for labels for edges. However, this class won't crash or throw an exception if it encounters any of the above attributes of an edge or a node. This class however, won't be able to deal with things like subgraphs and grouping of nodes.

Version:
  $Revision: 10222 $ - 23 Apr 2003 - Initial version (Ashraf M. Kibriya)
Author:
  Ashraf M. Kibriya (amk14@cs.waikato.ac.nz)

- ## Field Summary

  ### Fields inherited from interface weka.gui.graphvisualizer.GraphConstants

  `DIRECTED, DOUBLE, NORMAL, PLURAL_DUMMY, REVERSED, SINGULAR_DUMMY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DotParser(Reader input, ArrayList<GraphNode> nodes, ArrayList<GraphEdge> edges)`
  Dot parser Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `parse()`
  This method parses the string or the InputStream that we passed in through the constructor and builds up the m_nodes and m_edges vectors
  `static void`
  `writeDOT(String filename, String graphName, ArrayList<GraphNode> nodes, ArrayList<GraphEdge> edges)`
  This method saves a graph in a file in DOT format.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DotParser

    public DotParser(Reader input, ArrayList<GraphNode> nodes, ArrayList<GraphEdge> edges)
    Dot parser Constructor
    Parameters:
      `input` - - The input, if passing in a string then encapsulate that in String reader object
      `nodes` - - Vector to put in GraphNode objects, corresponding to the nodes parsed in from the input
      `edges` - - Vector to put in GraphEdge objects, corresponding to the edges parsed in from the input

- ## Method Details

  - ### parse

    public String parse()
    This method parses the string or the InputStream that we passed in through the constructor and builds up the m_nodes and m_edges vectors
    Returns:
      - returns the name of the graph

  - ### writeDOT

    public static void writeDOT(String filename, String graphName, ArrayList<GraphNode> nodes, ArrayList<GraphEdge> edges)
    This method saves a graph in a file in DOT format. However, if reloaded in GraphVisualizer we would need to layout the graph again.
    Parameters:
      `filename` - - The name of the file to write in. (will overwrite)
      `graphName` - - The name of the graph
      `nodes` - - Vector containing all the nodes
      `edges` - - Vector containing all the edges