org.processmining.framework.models
Class ModelGraph

java.lang.Object
  extended by att.grappa.Element
      extended by att.grappa.Subgraph
          extended by att.grappa.Graph
              extended by org.processmining.framework.models.ModelGraph
All Implemented Interfaces:
att.grappa.GrappaConstants, java.util.Comparator, DotFileWriter
Direct Known Subclasses:
ActivityGraph, AggregationGraph, Automaton, BPEL, BPEL4WS, CausalFootprint, ConfigurableEPC, PDMModel, PetriNet, ProcessInstanceVisualization.ProcessInstanceModelGraph, ProtosModel, ProtosRoleGraph, ProtosSubprocess, YAWLDecomposition, YAWLModel

public class ModelGraph
extends att.grappa.Graph
implements DotFileWriter

Encapsulates a general graph, and it is used as a base class for all types of graphs in the processmining project.

Since it extends Graph, all functionality of the GRAPPA graph library is available.

In addition, a ModelGraph provides a method getGrappaVisualization to create a visualization of the underlying graph. First, the DOT representation as given by the writeToDot method is layed out with the dot.exe tool. The output of dot.exe is then visualized using the Grappa package. Note that the visualization depends on the writeToDot method. Subclasses that want to customize the visualization should override the writeToDot method and customize the DOT representation, instead of overriding the getGrappaVisualization method.


Field Summary
static int DOESNTCROSS_REGION
           
static int ENTERS_REGION
           
static int EXITS_REGION
           
protected  java.lang.String identifier
           
protected static java.util.HashMap nodeMapping
           
protected  java.util.ArrayList vertices
           
 att.grappa.Graph visualObject
           
 
Fields inherited from class att.grappa.Graph
INDENT_STRING, REFCNTXT
 
Fields inherited from class att.grappa.Subgraph
currentSelection, defaultNamePrefix
 
Fields inherited from class att.grappa.Element
counter, highlight, linewidth, object, printAllAttributes, printDefaultAttributes, usePrintList, visible
 
Fields inherited from interface att.grappa.GrappaConstants
_NO_TYPE, ANONYMOUS_PREFIX, BBOX_ATTR, BBOX_HASH, BOX_SHAPE, BOX_TYPE, CLUSTERRANK_ATTR, COLOR_ATTR, COLOR_HASH, COLOR_TYPE, CUSTOM_ATTR, CUSTOM_HASH, CUSTOM_SHAPE, DELETION_MASK, DIAMOND_SHAPE, DIR_ATTR, DIR_HASH, DIR_TYPE, DISTORTION_ATTR, DISTORTION_HASH, DOUBLE_TYPE, DOUBLECIRCLE_SHAPE, DOUBLEOCTAGON_SHAPE, EDGE, EGG_SHAPE, FILLCOLOR_ATTR, FILLCOLOR_HASH, FONTCOLOR_ATTR, FONTCOLOR_HASH, FONTNAME_ATTR, FONTNAME_HASH, FONTSIZE_ATTR, FONTSIZE_HASH, FONTSTYLE_ATTR, FONTSTYLE_HASH, FONTSTYLE_TYPE, GRAPPA_BACKGROUND_COLOR_ATTR, GRAPPA_BACKGROUND_COLOR_HASH, GRAPPA_DELETION_STYLE_ATTR, GRAPPA_DELETION_STYLE_HASH, GRAPPA_FONTSIZE_ADJUSTMENT_ATTR, GRAPPA_FONTSIZE_ADJUSTMENT_HASH, GRAPPA_SELECTION_STYLE_ATTR, GRAPPA_SELECTION_STYLE_HASH, GRAPPA_SHAPE, HASHLIST_TYPE, HEIGHT_ATTR, HEIGHT_HASH, HEXAGON_SHAPE, HIGHLIGHT_MASK, HIGHLIGHT_OFF, HIGHLIGHT_ON, HIGHLIGHT_TOGGLE, HOUSE_SHAPE, IDENTXFRM, IMAGE_ATTR, IMAGE_HASH, INTEGER_TYPE, INVERTEDHOUSE_SHAPE, INVERTEDTRAPEZIUM_SHAPE, INVERTEDTRIANGLE_SHAPE, LABEL_ATTR, LABEL_HASH, LINE_SHAPE, LINE_TYPE, LOG10, LP_ATTR, LP_HASH, MARGIN_ATTR, MARGIN_HASH, MCIRCLE_SHAPE, MCLIMIT_ATTR, MCLIMIT_HASH, MDIAMOND_SHAPE, MINBOX_ATTR, MINBOX_HASH, MINLEN_ATTR, MINLEN_HASH, MINSIZE_ATTR, MINSIZE_HASH, MRECORD_SHAPE, MSQUARE_SHAPE, NBSP, NEW_LINE, NO_SHAPE, NODE, NODESEP_ATTR, NODESEP_HASH, OCTAGON_SHAPE, ORIENTATION_ATTR, ORIENTATION_HASH, OVAL_SHAPE, PACKAGE_PREFIX, PARALLELOGRAM_SHAPE, PATCH_ATTR, PATCH_HASH, PENTAGON_SHAPE, PERIPHERIES_ATTR, PERIPHERIES_HASH, PERIPHERY_GAP, PKG_LOWER, PKG_UPLOW, PKG_UPPER, PLAINTEXT_SHAPE, POINT_TYPE, PointsPerInch, POLYGON_SHAPE, POS_ATTR, POS_HASH, PRINTLIST_ATTR, PRINTLIST_HASH, RANKDIR_ATTR, RANKDIR_HASH, RANKSEP_ATTR, RANKSEP_HASH, RECORD_SHAPE, RECTS_ATTR, RECTS_HASH, ROTATION_ATTR, ROTATION_HASH, ROUNDEDBOX_SHAPE, SELECTION_MASK, SHAPE_ATTR, SHAPE_HASH, SHAPE_MASK, SHAPE_TYPE, SIDES_ATTR, SIDES_HASH, SIZE_ATTR, SIZE_HASH, SIZE_TYPE, SKEW_ATTR, SKEW_HASH, STRING_TYPE, STYLE_ATTR, STYLE_HASH, STYLE_TYPE, SUBGRAPH, SYSTEM, TAG_ATTR, TAG_HASH, TIP_ATTR, TIP_HASH, TRAPEZIUM_SHAPE, TRIANGLE_SHAPE, TRIPLEOCTAGON_SHAPE, TYPES_SHIFT, WEIGHT_ATTR, WEIGHT_HASH, WIDTH_ATTR, WIDTH_HASH
 
Constructor Summary
ModelGraph(java.lang.String graphName)
           
 
Method Summary
 ModelGraphEdge addEdge(ModelGraphEdge e)
           
 ModelGraphEdge addEdge(ModelGraphVertex source, ModelGraphVertex destination)
          Adds an edge from the first node to the second node, if no such adge already exists.
 ModelGraphVertex addVertex(ModelGraphVertex v)
           
 RegionList calculateAllNonCompRegions(java.util.Collection objects)
          This method calculates all non-complementary regions of this graph.
 RegionList calculateAllRegions(java.util.Collection objects)
          This method calculates all regions of this graph.
 RegionList calculateMinimalRegions(java.util.Collection objects)
          This method calculates all minimal regions of this graph.
 RegionList calculateRegionsMaxSize(java.util.Collection objects, int size)
          This method calculates all regions of this graph that contain at most size states.
protected  java.lang.Object clone()
          Makes a shallow copy of the object.
 void delEdge(ModelGraphVertex source, ModelGraphVertex destination)
           
 java.util.ArrayList getAllEdges(java.lang.Object o)
          Returns all edges in the statespace that refer to the given object
 java.util.HashSet getEdgeObjects()
          Returns a HashSet containing all objects that appear on edges, i.e.
 java.util.ArrayList getEdges()
           
 java.util.HashSet getEdgesBetween(ModelGraphVertex v1, ModelGraphVertex v2)
          September 5, 2005, Eric Verbeek OK for multiple arcs.
 ModelGraphEdge getFirstEdge(ModelGraphVertex source, ModelGraphVertex destination)
          September 5, 2005, Eric Verbeek Renamed from hasEdge to getFirstEdge Gets the first edge from the first node to the second node.
 ModelGraphPanel getGrappaVisualization()
          Returns a grappa panel containing the visualization of the graph.
 java.lang.String getIdentifier()
           
 int getNumberOfEdges()
           
 RegionList getPostRegions(RegionList regions, java.lang.Object t)
          This method returns a subset of the given set of regions, which represents the PreRegions of the given object.
 RegionList getPreRegions(RegionList regions, java.lang.Object t)
          This method returns a subset of the given set of regions, which represents the PreRegions of the given object.
 cern.colt.matrix.DoubleMatrix2D getShortestDistances()
           
 java.util.ArrayList<ModelGraphVertex> getVerticeList()
           
 boolean getWeightedArcs()
          September 5, 2005, Eric Verbeek Gets whether multiple arcs should be allowed or not.
 void reduceTransitively()
          Transitively reduces this graph, i.e.
 void removeEdge(ModelGraphEdge e)
           
 void removeEdges(java.util.ArrayList edges)
           
 void removeVertex(ModelGraphVertex v)
           
 void setIdentifier(java.lang.String s)
           
 void setWeightedArcs(boolean w)
          September 5, 2005, Eric Verbeek Sets whether multiple arcs should be allowed or not.
 void Test(java.lang.String tag)
          Print key indicators of the graph to the Test tab.
 void writeToDot(java.io.Writer bw)
          Writes a DOT representation of this graph to the given Writer.
 
Methods inherited from class att.grappa.Graph
addPanel, attributeType, buildShapes, decrementIndent, dropcloth, getErrorWriter, getGlobalAttribute, getGlobalAttributeKeys, getGlobalAttributePairs, getGlobalAttributeSize, getGrappaAttribute, getGrappaAttributeKeys, getGrappaAttributeValue, getId, getIndent, getSynchronizePaint, getToolTipText, incrementIndent, isDirected, isEditable, isMenuable, isSelectable, isStrict, paintImmediately, printError, printError, printGraph, printGraph, removePanel, repaint, reset, reset, resync, setEditable, setErrorWriter, setGrappaAttribute, setMenuable, setSelectable, setSynchronizePaint, setToolTipText, validGrappaAttributeKey
 
Methods inherited from class att.grappa.Subgraph
addEdge, addNode, addSubgraph, addTypeTag, clearPatchWork, compare, computePatchWork, countOfElements, countOfLocalElements, createElement, edgeElements, elements, elements, equals, findEdgeByName, findNodeByName, findSubgraphByName, getBoundingBox, getEdgeAttribute, getEdgeAttributeKeys, getEdgeAttributePairs, getEdgeAttributeValue, getNodeAttribute, getNodeAttributeKeys, getNodeAttributePairs, getNodeAttributeValue, getShowEdgeLabels, getShowNodeLabels, getShowSubgraphLabels, getType, hasEmptySubgraphs, hasTypeTag, hasTypeTags, isCluster, isLR, isRoot, isSubgraph, nodeElements, patchWork, preparePatchWork, printSubgraph, removeEdge, removeEmptySubgraphs, removeNode, removeSubgraph, removeTypeTag, removeTypeTags, resetBoundingBox, setAttribute, setAttribute, setEdgeAttribute, setEdgeAttribute, setName, setNodeAttribute, setNodeAttribute, setShowEdgeLabels, setShowNodeLabels, setShowSubgraphLabels, subgraphElements, vectorOfElements
 
Methods inherited from class att.grappa.Element
addTag, attrNotOfInterest, attrOfInterest, bdfs, buildShape, canonString, canonValue, clearBBox, delete, getAttribute, getAttributePairs, getAttributeValue, getDefaultAttribute, getDefaultAttribute, getGraph, getGrappaNexus, getId, getIdKey, getLocalAttribute, getLocalAttributeKeys, getLocalAttributePairs, getName, getSubgraph, getThisAttribute, getThisAttributeValue, hasAttributeForKey, hasDefaultTag, hasDefaultTags, hasLocalTag, hasLocalTags, hasTag, hasTags, isEdge, isNode, isOfInterest, listAttrsOfInterest, printElement, removeTag, removeTags, setDefaultAttribute, setDefaultAttribute, setDefaultAttribute, setDefaultAttribute, setIdKey, setSubgraph, setUserAttributeType, toString, typeString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXITS_REGION

public static final int EXITS_REGION
See Also:
Constant Field Values

ENTERS_REGION

public static final int ENTERS_REGION
See Also:
Constant Field Values

DOESNTCROSS_REGION

public static final int DOESNTCROSS_REGION
See Also:
Constant Field Values

visualObject

public att.grappa.Graph visualObject

identifier

protected java.lang.String identifier

vertices

protected java.util.ArrayList vertices

nodeMapping

protected static final java.util.HashMap nodeMapping
Constructor Detail

ModelGraph

public ModelGraph(java.lang.String graphName)
Method Detail

setWeightedArcs

public void setWeightedArcs(boolean w)
September 5, 2005, Eric Verbeek Sets whether multiple arcs should be allowed or not.

Parameters:
w - specifies whether multiple arcs should be allowed.

getWeightedArcs

public boolean getWeightedArcs()
September 5, 2005, Eric Verbeek Gets whether multiple arcs should be allowed or not.

Returns:
whether multiple arcs are allowed.

setIdentifier

public void setIdentifier(java.lang.String s)

getVerticeList

public java.util.ArrayList<ModelGraphVertex> getVerticeList()

getEdges

public java.util.ArrayList getEdges()

addVertex

public ModelGraphVertex addVertex(ModelGraphVertex v)

removeVertex

public void removeVertex(ModelGraphVertex v)

getIdentifier

public java.lang.String getIdentifier()

getEdgesBetween

public java.util.HashSet getEdgesBetween(ModelGraphVertex v1,
                                         ModelGraphVertex v2)
September 5, 2005, Eric Verbeek OK for multiple arcs. Gets the set of edges from the first node to the second node.

Parameters:
v1 - the first node
v2 - the second node
Returns:
the set of edges from the first node to the second node

getFirstEdge

public ModelGraphEdge getFirstEdge(ModelGraphVertex source,
                                   ModelGraphVertex destination)
September 5, 2005, Eric Verbeek Renamed from hasEdge to getFirstEdge Gets the first edge from the first node to the second node.

Parameters:
source - the first node
destination - the second node
Returns:
the first edge from the first node to the second node

removeEdges

public void removeEdges(java.util.ArrayList edges)

delEdge

public void delEdge(ModelGraphVertex source,
                    ModelGraphVertex destination)

removeEdge

public void removeEdge(ModelGraphEdge e)

getNumberOfEdges

public int getNumberOfEdges()

addEdge

public ModelGraphEdge addEdge(ModelGraphVertex source,
                              ModelGraphVertex destination)
Adds an edge from the first node to the second node, if no such adge already exists. If such an edge already exists, the ModelGraph's weightedArc attribute specifies whether a duplicate edge is added (true) or not (false).

Parameters:
source - the first node
destination - the second node
Returns:
the created edge (could be null if weightedArc is not set!)

addEdge

public ModelGraphEdge addEdge(ModelGraphEdge e)

writeToDot

public void writeToDot(java.io.Writer bw)
                throws java.io.IOException
Writes a DOT representation of this graph to the given Writer. This representation is used by the getGrappaVisualization method to generate the visualization. Note that this function should have a call to nodeMapping.clear() at the beginning and it should call nodeMapping.put(new String(nodeID),nodeObject); after writing a node to the dot file

Specified by:
writeToDot in interface DotFileWriter
Parameters:
bw - the DOT representation will be written using this Writer
Throws:
java.io.IOException - in case there is a problem with writing to bw

getGrappaVisualization

public final ModelGraphPanel getGrappaVisualization()
Returns a grappa panel containing the visualization of the graph. Note that the visualization is created from the DOT representation that is created with the writeToDot method. Subclasses that want to customize the visualization should override the writeToDot method instead of this one.

Returns:
the visualization of this graph in a grappa panel

getShortestDistances

public cern.colt.matrix.DoubleMatrix2D getShortestDistances()

clone

protected java.lang.Object clone()
Makes a shallow copy of the object. Note that cloning on this level is not supported but that the lists of vertices and edges are reset to the empty list, respectively, in order to properly support cloning for deriving subclasses.

Overrides:
clone in class java.lang.Object

calculateMinimalRegions

public RegionList calculateMinimalRegions(java.util.Collection objects)
This method calculates all minimal regions of this graph. A region is a set of nodes, such that for each objects in the given list of objects holds that: 1) All edges corresponding to that object have a source in the region and a destination outside of the region 2) All edges corresponding to that object have a source outside of the region and a destination inside the region 3) All edges corresponding to that object have a source in the region and a destination inside the region 4) All edges corresponding to that object have a source outside of the region and a destination outside of the region

Parameters:
objects - The list of objects to which edges can refer
Returns:
An ArrayList, containing HashSets of states in the statespace.

calculateAllRegions

public RegionList calculateAllRegions(java.util.Collection objects)
This method calculates all regions of this graph. A region is a set of nodes, such that for each objects in the given list of objects holds that: 1) All edges corresponding to that object have a source in the region and a destination outside of the region 2) All edges corresponding to that object have a source outside of the region and a destination inside the region 3) All edges corresponding to that object have a source in the region and a destination inside the region 4) All edges corresponding to that object have a source outside of the region and a destination outside of the region

Parameters:
objects - The list of objects to which edges can refer
Returns:
An ArrayList, containing HashSets of states in the statespace.

calculateAllNonCompRegions

public RegionList calculateAllNonCompRegions(java.util.Collection objects)
This method calculates all non-complementary regions of this graph. A region is a set of nodes, such that for each objects in the given list of objects holds that: 1) All edges corresponding to that object have a source in the region and a destination outside of the region 2) All edges corresponding to that object have a source outside of the region and a destination inside the region 3) All edges corresponding to that object have a source in the region and a destination inside the region 4) All edges corresponding to that object have a source outside of the region and a destination outside of the region

Parameters:
objects - The list of objects to which edges can refer
Returns:
An ArrayList, containing HashSets of states in the statespace.

calculateRegionsMaxSize

public RegionList calculateRegionsMaxSize(java.util.Collection objects,
                                          int size)
This method calculates all regions of this graph that contain at most size states. A region is a set of nodes, such that for each objects in the given list of objects holds that: 1) All edges corresponding to that object have a source in the region and a destination outside of the region 2) All edges corresponding to that object have a source outside of the region and a destination inside the region 3) All edges corresponding to that object have a source in the region and a destination inside the region 4) All edges corresponding to that object have a source outside of the region and a destination outside of the region

Parameters:
objects - The list of objects to which edges can refer
size - the maximum size of the region
Returns:
An ArrayList, containing HashSets of states in the statespace.

getEdgeObjects

public java.util.HashSet getEdgeObjects()
Returns a HashSet containing all objects that appear on edges, i.e. through the edge.object method.

Returns:
HashSet

getAllEdges

public java.util.ArrayList getAllEdges(java.lang.Object o)
Returns all edges in the statespace that refer to the given object

Parameters:
o - Object
Returns:
ArrayList

getPreRegions

public RegionList getPreRegions(RegionList regions,
                                java.lang.Object t)
This method returns a subset of the given set of regions, which represents the PreRegions of the given object.

Parameters:
regions - ArrayList
t - Object
Returns:
ArrayList

getPostRegions

public RegionList getPostRegions(RegionList regions,
                                 java.lang.Object t)
This method returns a subset of the given set of regions, which represents the PreRegions of the given object.

Parameters:
regions - ArrayList
t - Transition
Returns:
ArrayList

reduceTransitively

public void reduceTransitively()
Transitively reduces this graph, i.e. removes an edge if there is another path between two nodes. The result is unique for a-cyclic graphs


Test

public void Test(java.lang.String tag)
Print key indicators of the graph to the Test tab.

Parameters:
tag - String The tag to use for the indicators.