de.cau.cs.kieler.klay.layered.graph
Class LayeredGraph

java.lang.Object
  extended by de.cau.cs.kieler.core.properties.MapPropertyHolder
      extended by de.cau.cs.kieler.klay.layered.graph.LGraphElement
          extended by de.cau.cs.kieler.klay.layered.graph.LayeredGraph
All Implemented Interfaces:
IPropertyHolder, Comparable<LGraphElement>, Iterable<Layer>

public class LayeredGraph
extends LGraphElement
implements Iterable<Layer>

A layered graph has a set of layers that contain the nodes, as well as a list of nodes that are not yet assigned to a layer. Layout algorithms are required to layout the graph from left to right. If another layout direction is desired, it can be obtained by pre-processing and post-processing the graph.

Rating red

Field Summary
static Map<NodeType,String> NODE_TYPE_COLORS
          Map mapping node types to the colors used to represent those types when writing debug output graphs.
 
Fields inherited from class de.cau.cs.kieler.klay.layered.graph.LGraphElement
id
 
Constructor Summary
LayeredGraph()
           
 
Method Summary
 KVector getActualSize()
          Returns the graph's size including any borders.
 LInsets.Double getInsets()
          Returns the insets of the graph.
 List<LNode> getLayerlessNodes()
          Returns the list of nodes that are not currently assigned to a layer.
 List<Layer> getLayers()
          Returns the list of layers of the graph.
 KVector getOffset()
          Returns the offset for the graph, that is a coordinate vector that has to be added to all position values of nodes and edges.
 KVector getSize()
          Returns the size of the graph, that is the bounding box that covers the whole drawing.
 Iterator<Layer> iterator()
          Returns an iterator over the layers.
 String toString()
          
 void writeDotGraph(Writer writer)
          Outputs a representation of this graph in dot format to the given writer.
 
Methods inherited from class de.cau.cs.kieler.klay.layered.graph.LGraphElement
compareTo
 
Methods inherited from class de.cau.cs.kieler.core.properties.MapPropertyHolder
checkProperties, copyProperties, getAllProperties, getProperty, getProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NODE_TYPE_COLORS

public static final Map<NodeType,String> NODE_TYPE_COLORS
Map mapping node types to the colors used to represent those types when writing debug output graphs. The colors are given as strings of the form "#RGB", where each component is given as a two-digit hexadecimal value.

Constructor Detail

LayeredGraph

public LayeredGraph()
Method Detail

toString

public String toString()

Overrides:
toString in class Object

getSize

public KVector getSize()
Returns the size of the graph, that is the bounding box that covers the whole drawing. The size does not include insets or anything.

Returns:
the size of the layered graph

getActualSize

public KVector getActualSize()
Returns the graph's size including any borders. If the graph represents a hierarchical node, the returned size represents the node's size. The resturned size can be modified at will without having any influence on the graph's size or the actual size returned on the next method call.

Returns:
the graph's size including borders.

getInsets

public LInsets.Double getInsets()
Returns the insets of the graph. The insets determine the amount of space between the content area and the graph's actual border.

Returns:
the insets.

getOffset

public KVector getOffset()
Returns the offset for the graph, that is a coordinate vector that has to be added to all position values of nodes and edges. It is usually used to reserve some space in the content area for additional edge routing. Note: Since many different parts of the algorithm may contribute to the offset, never set the offset to an absolute value! Rather, only add to the offset!

Returns:
the offset of the layered graph

getLayerlessNodes

public List<LNode> getLayerlessNodes()
Returns the list of nodes that are not currently assigned to a layer.

Returns:
the layerless nodes.

getLayers

public List<Layer> getLayers()
Returns the list of layers of the graph.

Returns:
the layers

iterator

public Iterator<Layer> iterator()
Returns an iterator over the layers.

Specified by:
iterator in interface Iterable<Layer>
Returns:
an iterator for the layers of this layered graph

writeDotGraph

public void writeDotGraph(Writer writer)
                   throws IOException
Outputs a representation of this graph in dot format to the given writer. The following conventions are used:

Parameters:
writer - the writer to output the graph to. An attempt is made to close the writer when finished.
Throws:
IOException - if anything goes wrong with the writer.