org.processmining.framework.models.petrinet
Class PetriNet

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
                  extended by org.processmining.framework.models.petrinet.PetriNet
All Implemented Interfaces:
att.grappa.GrappaConstants, java.lang.Cloneable, java.util.Comparator, DotFileWriter
Direct Known Subclasses:
ColoredPetriNet, PDMPetriNet, PetriNetSimVisualization, ReplayedPetriNet, WFNet

public class PetriNet
extends ModelGraph
implements java.lang.Cloneable

A Petri net is a data structure that is used to model concurrent behavior. It can be represented as a bipartite (that is, the two types of node can only be connected in an alternating manner), directed graph connecting Transition nodes with Place nodes.

Author:
Boudewijn van Dongen
See Also:
Transition, Place, PNEdge, Token

Field Summary
 
Fields inherited from class org.processmining.framework.models.ModelGraph
DOESNTCROSS_REGION, ENTERS_REGION, EXITS_REGION, identifier, nodeMapping, vertices, 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
PetriNet()
          Creates an empty Petri net.
 
Method Summary
 boolean addAndLinkEdge(PNEdge e, Place p, Transition t)
          Adds a given edge from the given place (source node) to the given transition (target node).
 boolean addAndLinkEdge(PNEdge e, Transition t, Place p)
          Adds an edge from the given transition (source node) to the given place (target node).
 Place addAndLinkPlace(Place p)
          Adds a given place to this Petri net.
 Transition addAndLinkTransition(Transition t)
          Adds a given Transition to this Petri net.
 void addCluster(TransitionCluster tc)
          Adds a given cluster of transitions to the Petri net.
 boolean addEdge(Place p, Transition t)
          Adds a new PNEdge from the given place (source node) to the given transition (target node).
 boolean addEdge(Transition t, Place p)
          Adds an edge from the given transition (source node) to the given place (target node).
 void addNet(PetriNet pn)
          Adds ...
 Place addPlace(Place p)
          Adds a given place to this Petri net.
 Place addPlace(java.lang.String identifier)
          Adds a new place with a given identifier to this Petri net.
 boolean addToken(java.util.Date timestamp, Place p)
          Adds a token to the given place in this Petri net.
 Transition addTransition(LogEvent e)
          Deprecated. Please now use addTransition(Transition t);
 Transition addTransition(Transition t)
          Adds a given transition to this Petri net.
 java.lang.Object clone()
          Makes a deep copy of the object, i.e., reconstructs the Petri net structure with cloned transitions, places, edges, and clusters.
 void delPlace(Place p)
          Deletes a given place from this Petri net.
 void delTransition(Transition t)
          Deletes a given transition to this Petri net.
 PetriNet extractNet(java.util.Set<att.grappa.Node> nodes)
          Returns the a cloned subnet of this PetriNet containing the nodes of the input set argument.
 Place findPlace(java.util.Set in, java.util.Set out)
          Finds a place in the Petri net based on a given set of predecessor and successor nodes.
 Place findPlace(java.lang.String identifier)
          Finds a place in the Petri net based on a given identifier (which is assumed to be unique).
 Transition findRandomTransition(LogEvent lme)
          Finds a transition having the specified log event.
 Transition findTransition(LogEvent lme)
          Deprecated. Please use findTransition(Transition t) instead
 Transition findTransition(Transition t)
          Finds a transition in the Petri net which is equal to the given one (based on the equals method).
 java.util.ArrayList findTransitions(LogEvent lme)
          Finds all transitions having the specified log event.
protected  void finishDotWriting(java.io.Writer bw)
          This is the finishing part of the writeToDot procedure.
 java.util.ArrayList<TransitionCluster> getClusters()
          Returns all TransitionCluster objects known to this PetriNet.
 cern.colt.matrix.DoubleMatrix2D getIncidenceMatrix()
          Builds the incidence matrix belonging to this Petri net.
 cern.colt.matrix.DoubleMatrix2D getInputArcsTransitionsIncidenceMatrix()
          Builds the incidence matrix for the input arcs of transitions in this Petri net.
 java.util.ArrayList getInvisibleTasks()
          Retrieves the invisible tasks contained in this net.
 java.util.ArrayList<PNNode> getNodes()
           
 int getNumberOfInvisibleTasks()
          Retrieves the number of invisible tasks, i.e., those that do not have a corresponding log event.
 int getNumberOfNonDuplicateTasks()
          Retrieves the number of visible tasks without counting duplicate tasks multiple times.
 int getNumberOfVisibleTasks()
          Retrieves the number of transitions without counting invisible tasks, i.e., those that do not have a corresponding log event.
 cern.colt.matrix.DoubleMatrix2D getOutputArcsTransitionsIncidenceMatrix()
          Builds the incidence matrix for the output arcs of transitions in this Petri net.
 java.util.ArrayList<Place> getPlaces()
          Gets the Place nodes contained in this Petri net.
 ModelGraphVertex getSink()
          Returns the first sink found in the nodes of this Petri net
 ModelGraphVertex getSource()
          Returns the first source found in the nodes of this Petri net
 java.util.ArrayList<Transition> getTransitions()
          Gets the Transition nodes contained in this Petri net.
 java.util.ArrayList getVisibleTasks()
          Retrieves the visible tasks contained in this net.
protected  void initDotWriting(java.io.Writer bw)
          This is the part of the writeToDot procedure which initializes the temporary dot file by setting font, size, margin, etc.
 boolean isAcyclic()
          Determines if this net is acyclic
 void makeClusters()
          Clusters transitions based on their LogEvents.
 Place mergePlaces(Place p1, Place p2)
          Merges two given places into one single place.
 int numberOfNodes()
          Returns the number of nodes in this PetriNet, i.e., transitions plus places
 int numberOfPlaces()
          Returns the number of places in this PetriNet
 int numberOfTransitions()
          Returns the number of transitions in this PetriNet
 void removeVertex(ModelGraphVertex v)
           
 void Test(java.lang.String tag)
          Print key indicators of the PetriNet to the Test tab.
protected  void writeClustersToDot(java.io.Writer bw)
          This is the cluster writing part of the writeToDot procedure.
protected  void writeEdgesToDot(java.io.Writer bw)
          This is the edge writing part of the writeToDot procedure.
protected  void writePlacesToDot(java.io.Writer bw)
          This is the place writing part of the writeToDot procedure.
 void writeToDot(java.io.Writer bw)
          Writes a DOT representation of this graph to the given Writer.
protected  void writeTransitionsToDot(java.io.Writer bw)
          This is the transition writing part of the writeToDot procedure.
 
Methods inherited from class org.processmining.framework.models.ModelGraph
addEdge, addEdge, addVertex, calculateAllNonCompRegions, calculateAllRegions, calculateMinimalRegions, calculateRegionsMaxSize, delEdge, getAllEdges, getEdgeObjects, getEdges, getEdgesBetween, getFirstEdge, getGrappaVisualization, getIdentifier, getNumberOfEdges, getPostRegions, getPreRegions, getShortestDistances, getVerticeList, getWeightedArcs, reduceTransitively, removeEdge, removeEdges, setIdentifier, setWeightedArcs
 
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
 

Constructor Detail

PetriNet

public PetriNet()
Creates an empty Petri net. That is, not containing any transitions or places.

Method Detail

addCluster

public void addCluster(TransitionCluster tc)
Adds a given cluster of transitions to the Petri net. This cluster should contain a set of trantision objects that also appear in this Petri net. The cluster is used when writing to DOT to group these transitions. Note that transitions should only occur in one transition cluster, but this is not checked nor enforced.

Parameters:
tc - the TransitionCluster to be added

getClusters

public java.util.ArrayList<TransitionCluster> getClusters()
Returns all TransitionCluster objects known to this PetriNet.

Returns:
a list containing all transition clusters
See Also:
TransitionCluster

getTransitions

public java.util.ArrayList<Transition> getTransitions()
Gets the Transition nodes contained in this Petri net.

Returns:
a list of all transitions contained

getPlaces

public java.util.ArrayList<Place> getPlaces()
Gets the Place nodes contained in this Petri net.

Returns:
a list of all places contained

getNodes

public java.util.ArrayList<PNNode> getNodes()

mergePlaces

public Place mergePlaces(Place p1,
                         Place p2)
Merges two given places into one single place. That is, all predecessor transitions from both places will be connected via an edge to the new place as a source node, while all successor transitions will be connected to the new place as a target node. The two old places and all edges attached to them will be removed.

Parameters:
p1 - the first place to be merged
p2 - the second place to be merged
Returns:
the merged place, if both given places exist in this Petri net. Null otherwise.

addTransition

public Transition addTransition(Transition t)
Adds a given transition to this Petri net.
Note that the transition is expected to be associated to this Petri net already (so t.getSubgraph() should return this net). If you need that link to be established use addAndLinkTransition(Transition t) instead.

Parameters:
t - the transition to be added
Returns:
the newly added transition

addAndLinkTransition

public Transition addAndLinkTransition(Transition t)
Adds a given Transition to this Petri net.
Note that the transition is expected not to be associated to this Petri net already and this link will be established. If that link has been established already use addTransition(Transition t) instead.

Parameters:
t - the transition to be added
Returns:
the newly added transition

addTransition

public Transition addTransition(LogEvent e)
Deprecated. Please now use addTransition(Transition t);

Parameters:
e - the LogEvent of the transition to be added
Returns:
the newly added transition
See Also:
Adds a new transition to this Petri net. The transition is backed up by a LogEvent

delTransition

public void delTransition(Transition t)
Deletes a given transition to this Petri net. Note that all edges attached to this node will be removed as well.

Parameters:
t - the transition to be removed

delPlace

public void delPlace(Place p)
Deletes a given place from this Petri net. Note that all edges attached to this node will be removed as well.

Parameters:
p - the place to be removed

addPlace

public Place addPlace(Place p)
Adds a given place to this Petri net.
Note that the place is expected to be associated to this Petri net already (so t.getSubgraph() should return this net). If you need that link to be established use addAndLinkPlace(Place p) instead.

Parameters:
p - the place to be added
Returns:
the newly added place

addAndLinkPlace

public Place addAndLinkPlace(Place p)
Adds a given place to this Petri net.
Note that the place is expected not to be associated to this Petri net already and this link will be established. If that link has been established already use addPlace(Place p) instead.

Parameters:
p - the place to be added
Returns:
the newly added place

addPlace

public Place addPlace(java.lang.String identifier)
Adds a new place with a given identifier to this Petri net. In the case there is already a place with that identifier in this net, no new place will be created but the existing place will be returned.

Parameters:
identifier - the string specifying the identifier
Returns:
the newly created place, if the identifier was not assigned yet. The existing place otherwise.

addNet

public void addNet(PetriNet pn)
Adds ...

Parameters:
pn - the Petri net to be added

addEdge

public boolean addEdge(Place p,
                       Transition t)
Adds a new PNEdge from the given place (source node) to the given transition (target node).

Parameters:
p - the place specified as the source node for the new edge
t - the transition specified as the target node for the new edge
Returns:
true if both the transition and the place are contained in this Petri net, false otherwise

addAndLinkEdge

public boolean addAndLinkEdge(PNEdge e,
                              Place p,
                              Transition t)
Adds a given edge from the given place (source node) to the given transition (target node). Note that head and tail node of the edge will be updated correspondignly.

Parameters:
e - the edge to be added from p to t
p - the place specified as the source node for the new edge
t - the transition specified as the target node for the new edge
Returns:
true if both the transition and the place are contained in this Petri net, false otherwise

addEdge

public boolean addEdge(Transition t,
                       Place p)
Adds an edge from the given transition (source node) to the given place (target node).

Parameters:
t - the transition specified as the source node for the new edge
p - the place specified as the target node for the new edge
Returns:
true if both the transition and the place are contained in this Petri net, false otherwise

addAndLinkEdge

public boolean addAndLinkEdge(PNEdge e,
                              Transition t,
                              Place p)
Adds an edge from the given transition (source node) to the given place (target node).

Parameters:
e - the edge to be added from t to p
t - the transition specified as the source node for the new edge
p - the place specified as the target node for the new edge
Returns:
true if both the transition and the place are contained in this Petri net, false otherwise

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

When a petri net is asked for its visualization, a temporary dot file is written and afterwards read by grappa to convert it into a java frame. Therefore, to modify the vizualization of a Petri net, this method needs to be overridden.

Since internally the write procedure is decomposed into semantically distinct sections, it is recommended to only override the sub procedures that are affected by the given modifications.

The partial steps include: initDotWriting, writeTransitionsToDot, writePlacesToDot, writeEdgesToDot, and writeAdditionsToDot.

Specified by:
writeToDot in interface DotFileWriter
Overrides:
writeToDot in class ModelGraph
Parameters:
bw - the writer used by the framework to create the temporary dot file
Throws:
java.io.IOException - if writing to the writer fails

initDotWriting

protected void initDotWriting(java.io.Writer bw)
                       throws java.io.IOException
This is the part of the writeToDot procedure which initializes the temporary dot file by setting font, size, margin, etc. parameters.

Parameters:
bw - the writer used by the framework to create the temporary dot file
Throws:
java.io.IOException - if writing to the writer fails

writeTransitionsToDot

protected void writeTransitionsToDot(java.io.Writer bw)
                              throws java.io.IOException
This is the transition writing part of the writeToDot procedure.

Parameters:
bw - the writer used by the framework to create the temporary dot file
Throws:
java.io.IOException - if writing to the writer fails

writePlacesToDot

protected void writePlacesToDot(java.io.Writer bw)
                         throws java.io.IOException
This is the place writing part of the writeToDot procedure.

Parameters:
bw - the writer used by the framework to create the temporary dot file
Throws:
java.io.IOException - if writing to the writer fails

writeEdgesToDot

protected void writeEdgesToDot(java.io.Writer bw)
                        throws java.io.IOException
This is the edge writing part of the writeToDot procedure.

Parameters:
bw - the writer used by the framework to create the temporary dot file
Throws:
java.io.IOException - if writing to the writer fails

writeClustersToDot

protected void writeClustersToDot(java.io.Writer bw)
                           throws java.io.IOException
This is the cluster writing part of the writeToDot procedure. The transition clusters are visualized drawing a blue box around those transitions belonging to one group, i.e., cluster.

Parameters:
bw - the writer used by the framework to create the temporary dot file
Throws:
java.io.IOException - if writing to the writer fails
See Also:
getClusters, makeClusters

finishDotWriting

protected void finishDotWriting(java.io.Writer bw)
                         throws java.io.IOException
This is the finishing part of the writeToDot procedure. Here the graph is only closed but overriding classes might want to add additional visualization elements after writing the acutal Petri net.

Parameters:
bw - the writer used by the framework to create the temporary dot file
Throws:
java.io.IOException - if writing to the writer fails

addToken

public boolean addToken(java.util.Date timestamp,
                        Place p)
Adds a token to the given place in this Petri net. If the given place is contained in this Petri net, a new token will be created with the given time stamp and attached to it.

Parameters:
timestamp - the date to be attached with the token
p - the place where the token should be added
Returns:
true if the token could be added, false otherwise

findRandomTransition

public Transition findRandomTransition(LogEvent lme)
Finds a transition having the specified log event.

Use this method if you know that there are no multiple transitions associated to the same log event (i.e., duplicate tasks), or if finding one of them would suffice.

If you want to get a complete list of transitions having the specified log event, use findTransitions instead.

Parameters:
lme - the log event specified
Returns:
one transition associated to the given log event, if existent. Null otherwise.

findTransitions

public java.util.ArrayList findTransitions(LogEvent lme)
Finds all transitions having the specified log event.

Use this method if you expect the net having multiple transitions associated to the same log event (i.e., duplicate tasks).

If this cannot happen or finding one of them would suffice, you can use findRandomTransition instead, which will directly return the first element of that list.

Parameters:
lme - the log event specified
Returns:
a list of all transitions associated to the given log event. The list may be empty.

findTransition

public Transition findTransition(LogEvent lme)
Deprecated. Please use findTransition(Transition t) instead

Parameters:
e - the LogEvent to compare with
Returns:
an equal transition, if existent. Null otherwise.
See Also:
Finds a transition in the Petri net with a link to the given LogEvent. In case there are more, it returns the first

findTransition

public Transition findTransition(Transition t)
Finds a transition in the Petri net which is equal to the given one (based on the equals method).

Parameters:
t - the transition to compare with
Returns:
an equal transition, if existent. Null otherwise.

findPlace

public Place findPlace(java.lang.String identifier)
Finds a place in the Petri net based on a given identifier (which is assumed to be unique).

Parameters:
identifier - the string specifying the identifier
Returns:
the place having the given identifier, if existent. Null otherwise.

findPlace

public Place findPlace(java.util.Set in,
                       java.util.Set out)
Finds a place in the Petri net based on a given set of predecessor and successor nodes.

Parameters:
in - the set of predecessor nodes
out - the set of successor nodes
Returns:
the first place having the given set of predecessor and successor nodes, if existent. Null otherwise.

makeClusters

public void makeClusters()
Clusters transitions based on their LogEvents. All Transition with a LogEvent with the same name are clustered using the addCluster method.


getIncidenceMatrix

public cern.colt.matrix.DoubleMatrix2D getIncidenceMatrix()
Builds the incidence matrix belonging to this Petri net.

Returns:
the incidence matrix belonging to this Petri net

getInputArcsTransitionsIncidenceMatrix

public cern.colt.matrix.DoubleMatrix2D getInputArcsTransitionsIncidenceMatrix()
Builds the incidence matrix for the input arcs of transitions in this Petri net.

Returns:
the input arcs transitions incidence matrix belonging to this Petri net

getOutputArcsTransitionsIncidenceMatrix

public cern.colt.matrix.DoubleMatrix2D getOutputArcsTransitionsIncidenceMatrix()
Builds the incidence matrix for the output arcs of transitions in this Petri net.

Returns:
the output arcs transitions incidence matrix belonging to this Petri net

getNumberOfVisibleTasks

public int getNumberOfVisibleTasks()
Retrieves the number of transitions without counting invisible tasks, i.e., those that do not have a corresponding log event.

Returns:
the number of visible transitions

getNumberOfInvisibleTasks

public int getNumberOfInvisibleTasks()
Retrieves the number of invisible tasks, i.e., those that do not have a corresponding log event.

Returns:
the number of invisible transitions

getInvisibleTasks

public java.util.ArrayList getInvisibleTasks()
Retrieves the invisible tasks contained in this net.

Returns:
the list of those transitions that resemble invisible tasks. The list may be empty if the model contains no invisible tasks

getVisibleTasks

public java.util.ArrayList getVisibleTasks()
Retrieves the visible tasks contained in this net.

Returns:
the list of those transitions that resemble visible tasks. The list may be empty if the model contains no visible tasks

getNumberOfNonDuplicateTasks

public int getNumberOfNonDuplicateTasks()
Retrieves the number of visible tasks without counting duplicate tasks multiple times. Note that this corresponds to counting the number of different task labels.

Returns:
int the number of non-duplicate tasks

getSource

public ModelGraphVertex getSource()
Returns the first source found in the nodes of this Petri net

Returns:
A source of this Petri net

getSink

public ModelGraphVertex getSink()
Returns the first sink found in the nodes of this Petri net

Returns:
A sink of this Petri net

extractNet

public PetriNet extractNet(java.util.Set<att.grappa.Node> nodes)
Returns the a cloned subnet of this PetriNet containing the nodes of the input set argument. Only edges that has both head and tail that belongs to the input set are included.

Parameters:
A - set of nodes that belongs to this PetriNet
Returns:
A cloned PetriNet containing only nodes of the input set

numberOfPlaces

public int numberOfPlaces()
Returns the number of places in this PetriNet

Returns:
The number of places

numberOfTransitions

public int numberOfTransitions()
Returns the number of transitions in this PetriNet

Returns:
The number of transitions

numberOfNodes

public int numberOfNodes()
Returns the number of nodes in this PetriNet, i.e., transitions plus places

Returns:
The number of nodes

isAcyclic

public boolean isAcyclic()
Determines if this net is acyclic

Returns:
True if the net is acyclic and false otherwise

removeVertex

public void removeVertex(ModelGraphVertex v)
Overrides:
removeVertex in class ModelGraph
See Also:
ModelGraph.removeVertex(org.processmining.framework.models.ModelGraphVertex)

clone

public java.lang.Object clone()
Makes a deep copy of the object, i.e., reconstructs the Petri net structure with cloned transitions, places, edges, and clusters. Note that this method needs to be extended as soon as there are attributes added to the class which are not primitive or immutable.

Overrides:
clone in class ModelGraph
Returns:
the cloned object

Test

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

Overrides:
Test in class ModelGraph
Parameters:
tag - String The tag to use for the indicators.