de.unihalle.informatik.MiToBo.io.files
Class GraphvizWriter<T extends Comparable<?> & Comparator<?>>

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDOperator
      extended by de.unihalle.informatik.MiToBo.io.files.GraphvizWriter<T>
Type Parameters:
T - Type of the nodes' data objects
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, de.unihalle.informatik.Alida.operator.events.ALDOperatorExecutionProgressEventListener, EventListener

@ALDMetaInfo(export=ALLOWED)
@ALDAOperator(genericExecutionMode=NONE,
              level=STANDARD)
public class GraphvizWriter<T extends Comparable<?> & Comparator<?>>
extends de.unihalle.informatik.Alida.operator.ALDOperator

Write graph to file using the DOT-language for visualization using graphviz tools. A main graph has to be specified whether as MTBGraph or AdjacencyMatrix. Further, subgraphs can be specified which then are painted in the specified color. If T is of type MatchingAdjacencyMatrix.NodeID, the nodes of each partition are drawn with same rank, i.e. they are lined up horizontally.

Author:
Oliver Gress

Nested Class Summary
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
protected  AdjacencyMatrix<T> adjmatrix
           
protected  String[] dotGlobalAttributes
           
protected  String filename
           
protected  MTBGraph graph
           
protected  double maxWeight
           
protected  Vector<MTBGraph> subgraphs
           
protected  Vector<AdjacencyMatrix<T>> subgraphs_adj
           
protected  Vector<Color> subgraphs_adj_color
           
protected  Vector<Color> subgraphs_color
           
protected  boolean weightAsEdgeThickness
           
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
 
Constructor Summary
GraphvizWriter()
          Empty constructor
GraphvizWriter(AdjacencyMatrix<T> adjmatrix, String filename)
          Constructor for specifying the graph by an adjacency matrix
GraphvizWriter(MTBGraph graph, String filename)
          Constructor for specifying the graph by MTBGraph
 
Method Summary
 void addSubgraph(MTBGraph subgraph, Color c)
          Specify a subgraph that is to be painted in the given color.
 void addSubgraphAdjaceny(AdjacencyMatrix<T> subgraph_adj, Color c)
          Specify a subgraph that is to be painted in the given color.
protected  void operate()
           
 void setAdjacencyMatrix(AdjacencyMatrix<T> adjmatrix)
          Set the main graph's adjacency matrix
 void setDotGlobalAttributes(String[] dotGlobalAttributes)
          Set global attributes of the graph e.g. the style of the nodes etc.
 void setFilename(String filename)
          Set the filename for output
 void setGraph(MTBGraph graph)
          Set the main graph using MTBGraph
 void setMaxWeight(double maxWeight)
          Specify the maximum weight in the graph.
 void setWeightAsEdgeThickness(boolean weightAsEdgeThickness)
          Set flag how edge weights are visualized.
 void validateCustom()
           
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
addOperatorExecutionProgressEventListener, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getHidingMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, isConfigured, print, print, print, printInterface, printInterface, readHistory, readResolve, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, runOp, runOp, runOp, setConstructionMode, setHidingMode, setName, setParameter, setVerbose, toStringVerbose, unconfiguredItems, validate, validateGeneric, writeHistory, writeHistory, writeHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

adjmatrix

@Parameter(label="adjmatrix",
           direction=IN,
           required=false,
           description="Adjacency matrix of the input graph")
protected AdjacencyMatrix<T extends Comparable<?> & Comparator<?>> adjmatrix

graph

@Parameter(label="graph",
           direction=IN,
           required=false,
           description="Input graph")
protected MTBGraph graph

filename

@Parameter(label="filename",
           direction=IN,
           required=true,
           description="Output file name")
protected String filename

weightAsEdgeThickness

@Parameter(label="weightAsEdgeThickness",
           direction=IN,
           required=true,
           description="Visualize weights by edge thickness")
protected boolean weightAsEdgeThickness

dotGlobalAttributes

@Parameter(label="dotGlobalAttributes",
           direction=IN,
           required=false,
           description="Global attributes for graph drawing (dot commands), e.g. node/edge style, color etc.")
protected String[] dotGlobalAttributes

maxWeight

@Parameter(label="maxWeight",
           direction=IN,
           required=false,
           description="Maximum weight/cost in the graph, needed to limit edge thickness to 10pts if weights are visualized by edge thickness.")
protected double maxWeight

subgraphs

protected Vector<MTBGraph> subgraphs

subgraphs_color

protected Vector<Color> subgraphs_color

subgraphs_adj

protected Vector<AdjacencyMatrix<T extends Comparable<?> & Comparator<?>>> subgraphs_adj

subgraphs_adj_color

protected Vector<Color> subgraphs_adj_color
Constructor Detail

GraphvizWriter

public GraphvizWriter()
               throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Empty constructor

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

GraphvizWriter

public GraphvizWriter(AdjacencyMatrix<T> adjmatrix,
                      String filename)
               throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor for specifying the graph by an adjacency matrix

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

GraphvizWriter

public GraphvizWriter(MTBGraph graph,
                      String filename)
               throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor for specifying the graph by MTBGraph

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

validateCustom

public void validateCustom()
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Overrides:
validateCustom in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

operate

protected void operate()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                       de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Specified by:
operate in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

setAdjacencyMatrix

public void setAdjacencyMatrix(AdjacencyMatrix<T> adjmatrix)
Set the main graph's adjacency matrix


setGraph

public void setGraph(MTBGraph graph)
Set the main graph using MTBGraph


setFilename

public void setFilename(String filename)
Set the filename for output


setWeightAsEdgeThickness

public void setWeightAsEdgeThickness(boolean weightAsEdgeThickness)
Set flag how edge weights are visualized. If flag is true weights are visualized by edge thickness, otherwise edges are labeled with the value of their weigth.


setDotGlobalAttributes

public void setDotGlobalAttributes(String[] dotGlobalAttributes)
Set global attributes of the graph e.g. the style of the nodes etc. The given strings must match DOT-language commands, e.g 'node [style = "bold"];'.


setMaxWeight

public void setMaxWeight(double maxWeight)
Specify the maximum weight in the graph. This value is used to limit edge-thickness to 10 pts if weights are visualized by edge thickness (edgethickness = weight/maxWeight*10). Default is 1 !!


addSubgraph

public void addSubgraph(MTBGraph subgraph,
                        Color c)
Specify a subgraph that is to be painted in the given color.


addSubgraphAdjaceny

public void addSubgraphAdjaceny(AdjacencyMatrix<T> subgraph_adj,
                                Color c)
Specify a subgraph that is to be painted in the given color.



Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.