Package it.univr.di.cstnu.graph
Class TNGraph<E extends Edge>
java.lang.Object
edu.uci.ics.jung.graph.AbstractGraph<LabeledNode,E>
edu.uci.ics.jung.graph.AbstractTypedGraph<LabeledNode,E>
it.univr.di.cstnu.graph.TNGraph<E>
- Type Parameters:
E
- type of edge
- All Implemented Interfaces:
edu.uci.ics.jung.graph.DirectedGraph<LabeledNode,
,E> edu.uci.ics.jung.graph.Graph<LabeledNode,
,E> edu.uci.ics.jung.graph.Hypergraph<LabeledNode,
,E> PropertyChangeListener
,Serializable
,EventListener
- Direct Known Subclasses:
TNGraph.UnmodifiableTNGraph
public class TNGraph<E extends Edge>
extends edu.uci.ics.jung.graph.AbstractTypedGraph<LabeledNode,E>
implements edu.uci.ics.jung.graph.DirectedGraph<LabeledNode,E>, PropertyChangeListener
Represents (dense) temporal network graphs where nodes are
LabeledNode
and edges are (an extension of)
Edge
. This class implements the interface DirectedGraph
in order to allow the representation of Graph by the JUNG library.- Version:
- $Rev: 993 $
- Author:
- posenato
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Types of networks that this class can represent.static class
TNGraph.UnmodifiableTNGraph<K extends Edge>
Unmodifiable version of this graph. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final float
Adjacency grow factor: This represents the multiplication factor used to increase the dimension of the adjacency matrix.Fields inherited from class edu.uci.ics.jung.graph.AbstractTypedGraph
edge_type
-
Constructor Summary
ConstructorsConstructorDescriptionA constructor that copies a given graph g using the copy constructor for internal structures.
If g is null, this new graph will be empty.A constructor that copies a given graph g using the copy constructor for internal structures.
If g is null, this new graph will be empty.Constructor for TNGraph.TNGraph
(String graphName, Class<E1> inputEdgeImplClass, ALabelAlphabet alphabet) Constructor for TNGraph. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChildToObserverNode
(LabeledNode obs, char child) Add child to obs.boolean
addEdge
(E edge, edu.uci.ics.jung.graph.util.Pair<? extends LabeledNode> vertices) Unsupportedboolean
addEdge
(E edge, edu.uci.ics.jung.graph.util.Pair<? extends LabeledNode> endpoints, edu.uci.ics.jung.graph.util.EdgeType edgeType) boolean
addEdge
(E e, LabeledNode v1, LabeledNode v2) Adds the edge if there is no edge between v1 and v2.boolean
addEdge
(E e, LabeledNode v1, LabeledNode v2, edu.uci.ics.jung.graph.util.EdgeType edge_type1) void
Optimized method for adding an edge.boolean
addEdge
(E edge, Collection<? extends LabeledNode> vertices) Unsupportedboolean
addEdge
(E edge, Collection<? extends LabeledNode> vertices, edu.uci.ics.jung.graph.util.EdgeType t) Unsupportedvoid
addEdgeWithoutCheck
(E e, String v1Name, String v2Name) Optimized method for adding an edge without any security check and listener modification for edges.boolean
addVertex
(LabeledNode vertex) Adds the given vertex to the graph.void
addVertexWithoutCheck
(LabeledNode vertex) Adds the given vertex to the graph without checking its previous presence and without adding any listeners to it.void
clear()
Clear all internal structures.void
clear
(int initialAdjSize) Clear all internal structures.void
Clear all internal caches.boolean
containsEdge
(E edge) boolean
containsVertex
(LabeledNode vertex) void
A defensive copy of all 'g' internal structures.void
Makes a copy ascopy(TNGraph)
removing all labeled values having unknown literal(s) or -∞ value.int
degree
(LabeledNode vertex) it.unimi.dsi.fastutil.objects.ObjectList
<it.unimi.dsi.fastutil.objects.ObjectObjectImmutablePair<E, E>> differentEdgesOf
(TNGraph<E> g1) Returns the list of different edges of this graph from g1.findEdge
(LabeledNode s, LabeledNode d) Find the edge given the names of the source node and the destination node.getChildrenOf
(LabeledNode obs) Given an observation nodeobs
that observes the proposition 'p', its 'children' are all observation nodes, Q, for which 'p' appears in the label of node Q.int
WrappergetDest(Edge)
Returns the edge associated with the name.int
Getter for the fieldedgeFactory
.getEdges()
Returns an independent collection of the edges of this graph.it.unimi.dsi.fastutil.objects.ObjectList
<org.apache.commons.lang3.tuple.Triple<LabeledNode, E, LabeledNode>> It is an optimization ofgetInEdges(LabeledNode)
that also returns the source node of the incoming edge.edu.uci.ics.jung.graph.util.Pair
<LabeledNode> getEndpoints
(E edge) getEdgesArray.it.unimi.dsi.fastutil.objects.ObjectList
<E> getIncidentEdges
(LabeledNode vertex) it.unimi.dsi.fastutil.objects.ObjectList
<E> getInEdges
(LabeledNode vertex) it.unimi.dsi.fastutil.objects.ObjectList
<it.unimi.dsi.fastutil.objects.ObjectObjectImmutablePair<E, LabeledNode>> getInEdgesAndNodes
(LabeledNode vertex) It is an optimization ofgetInEdges(LabeledNode)
that also returns the source node of the incoming edge.it.unimi.dsi.fastutil.objects.ObjectList
<BasicCSTNUEdge> getName()
getNeighbors
(LabeledNode vertex) Returns the node associated with the name.it.unimi.dsi.fastutil.chars.Char2ObjectMap
<LabeledNode> getObserver
(char c) it.unimi.dsi.fastutil.objects.ObjectList
<E> Be careful!int
it.unimi.dsi.fastutil.objects.ObjectList
<E> getOutEdges
(LabeledNode vertex) it.unimi.dsi.fastutil.objects.ObjectList
<it.unimi.dsi.fastutil.objects.ObjectObjectImmutablePair<E, LabeledNode>> getOutEdgesAndNodes
(LabeledNode vertex) It is an optimization ofgetOutEdges(LabeledNode)
that also returns the destination node of the outgoing edge.getPredecessors
(LabeledNode vertex) it.unimi.dsi.fastutil.chars.CharSet
getPropositions.Wrapper ofgetSource(Edge)
getSuccessors
(LabeledNode vertex) getType()
getUniqueEdgeName
(String edgeName) int
getVerticesArray.getZ()
boolean
hasSameEdgesOf
(TNGraph<E> g1) Returns true if this graph has the same set of edges as g1.boolean
hasSameVerticesOf
(TNGraph<E> g1) int
inDegree
(LabeledNode vertex) boolean
isDest
(LabeledNode vertex, E edge) boolean
isSource
(LabeledNode vertex, E edge) makeNewEdge
(String edgeName, Edge.ConstraintType edgeType) Creates a new edge proper for this graph using edgeName as a proposed name (it will be modified by adding a suffix if there is already another edge with name edgeName) and setting the type to type.int
outDegree
(LabeledNode vertex) void
boolean
removeEdge
(E edge) boolean
removeEdge
(String edgeName) Removes the edge from this graph and clears all cache data structures that could contain the removed edge.boolean
Removes all empty edges in the graph.boolean
removeVertex
(LabeledNode removingNode) Removes the given node and all edges having it as an endpoint.void
reverse()
Reverse (transpose) the current graph.void
setAllPotential
(int v) Sets the potential of each node tov
.void
setInputFile
(File file) void
void
setType
(TNGraph.NetworkType type) Sets the type of network.
Warning: this method was introduced for setting the PSTN type because it is not simple to determine it from the kind of edges.void
setZ
(LabeledNode z) Setsz
as the first node (Zero node) of the temporal constraint network.void
Takes from g1 all its internal structures.toString()
void
Transposesthis
, inverting only the source/destination of each edge.static <K extends Edge>
TNGraph.UnmodifiableTNGraph<K> unmodifiable
(TNGraph<K> g) Returns an unmodifiable TNGraph backed by the given TNGraph.Methods inherited from class edu.uci.ics.jung.graph.AbstractTypedGraph
getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType, hasEqualEdgeType, validateEdgeType
Methods inherited from class edu.uci.ics.jung.graph.AbstractGraph
findEdgeSet, getIncidentCount, getIncidentVertices, getNeighborCount, getOpposite, getPredecessorCount, getSuccessorCount, getValidatedEndpoints, isIncident, isNeighbor, isPredecessor, isSuccessor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.uci.ics.jung.graph.Graph
getOpposite, getPredecessorCount, getSuccessorCount, isPredecessor, isSuccessor
Methods inherited from interface edu.uci.ics.jung.graph.Hypergraph
findEdgeSet, getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType, getIncidentCount, getIncidentVertices, getNeighborCount, isIncident, isNeighbor
-
Field Details
-
growFactor
static final float growFactorAdjacency grow factor: This represents the multiplication factor used to increase the dimension of the adjacency matrix. It has to be at least 1.5.- See Also:
-
-
Constructor Details
-
TNGraph
Constructor for TNGraph.- Type Parameters:
E1
- type of edge- Parameters:
graphName
- a name for the graphinputEdgeImplClass
- type of edges
-
TNGraph
public TNGraph(@Nonnull String graphName, @Nonnull Class<E1> inputEdgeImplClass, @Nullable ALabelAlphabet alphabet) Constructor for TNGraph.- Type Parameters:
E1
- type of edge- Parameters:
graphName
- a name for the graphinputEdgeImplClass
- type of edgesalphabet
- alphabet for upper-case letters used to label values in the edges.
-
TNGraph
public TNGraph(@Nonnull TNGraph<E> inputGraph, @Nonnull Class<E1> edgeImplClass, boolean sameNodes, boolean useFastAddEdge) A constructor that copies a given graph g using the copy constructor for internal structures.
If g is null, this new graph will be empty.
Be careful: this copy constructor is good only to create graphs that are not manipulated byTNEditor
because all listener about nodes and edges are not activated.- Type Parameters:
E1
- type of edge- Parameters:
inputGraph
- the graph to be clonededgeImplClass
- classsameNodes
- if true, the nodes are shared between the given graph and the generated one.useFastAddEdge
- if true, it adds edges without making any checks about the possible redundant names, missing nodes, etc. Use it to create a big graph only for internal use.
-
TNGraph
A constructor that copies a given graph g using the copy constructor for internal structures.
If g is null, this new graph will be empty.- Type Parameters:
E1
- type of edge- Parameters:
inputGraph
- the graph to be clonededgeImplClass
- class
-
-
Method Details
-
unmodifiable
Returns an unmodifiable TNGraph backed by the given TNGraph.- Type Parameters:
K
- the type of edges- Parameters:
g
- The TNGraph is to be wrapped in an unmodifiable map.- Returns:
- an unmodifiable view of the specified TNGraph.
-
addChildToObserverNode
Add child to obs. It is the user's responsibility to ensure that 'child' is a child in the CSTN sense of 'obs'. No validity check is made using this method.- Parameters:
obs
- aLabeledNode
object.child
- a char.
-
addEdge
Adds the edge if there is no edge between v1 and v2. Moreover, node(s) are added if they are not present in the graph. It callsaddEdge(Edge, String, String)
method.- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge> - Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<LabeledNode,
E extends Edge> - See Also:
-
addEdge
public boolean addEdge(@Nonnull E e, @Nonnull LabeledNode v1, @Nonnull LabeledNode v2, @Nonnull edu.uci.ics.jung.graph.util.EdgeType edge_type1) - Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge> - Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<LabeledNode,
E extends Edge>
-
addEdge
public boolean addEdge(@Nonnull E edge, @Nonnull edu.uci.ics.jung.graph.util.Pair<? extends LabeledNode> endpoints, @Nonnull edu.uci.ics.jung.graph.util.EdgeType edgeType) - Specified by:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<LabeledNode,
E extends Edge>
-
addEdge
Unsupported- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge> - Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<LabeledNode,
E extends Edge>
-
addEdge
public boolean addEdge(@Nonnull E edge, @Nonnull Collection<? extends LabeledNode> vertices, edu.uci.ics.jung.graph.util.EdgeType t) Unsupported- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge> - Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<LabeledNode,
E extends Edge>
-
addEdge
Optimized method for adding an edge. It exploits the internal structure of the class.
Adds the input edge if an edge between v1Name and v2Name does not exist.- Parameters:
e
- not nullv1Name
- not nullv2Name
- not null- Throws:
IllegalArgumentException
- if e has an equal name to another edge in the graph, or if there is already an edge between the two nodes.
-
addEdge
public boolean addEdge(@Nonnull E edge, @Nonnull edu.uci.ics.jung.graph.util.Pair<? extends LabeledNode> vertices) Unsupported- Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<LabeledNode,
E extends Edge>
-
addEdgeWithoutCheck
Optimized method for adding an edge without any security check and listener modification for edges. Use this method if and only if the graph does not require being managed byTNEditor
and it is necessary to add edges in a very fast way.
Adds the input edge if an edge between v1Name and v2Name does not exist.- Parameters:
e
- not nullv1Name
- not nullv2Name
- not null- Throws:
IllegalArgumentException
- if e has an equal name to another edge in the graph, or if there is already an edge between the two nodes.
-
addVertex
Adds the given vertex to the graph.- Specified by:
addVertex
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge> - Throws:
IllegalArgumentException
- if a vertex has an equal name to another vertex in the graph, or if it is an observer of a condition for which there is another observer already in the graph.
-
addVertexWithoutCheck
Adds the given vertex to the graph without checking its previous presence and without adding any listeners to it.Use this method if and only if the graph does not require being managed by
TNEditor
and it is necessary to add edges in a very fast way.- Parameters:
vertex
- the input vertex- Throws:
IllegalArgumentException
- if a vertex has an equal name to another vertex in the graph, or if it is an observer of a condition for which there is already another observer in the graph.
-
clear
public void clear()Clear all internal structures. The graph will be empty. -
clear
public void clear(int initialAdjSize) Clear all internal structures. The graph will be erased.- Parameters:
initialAdjSize
- initial number of vertices.
-
clearCache
public void clearCache()Clear all internal caches.Caches are automatically created during any modification or query about the graph structure.
-
containsEdge
- Specified by:
containsEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
containsVertex
- Specified by:
containsVertex
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
copy
A defensive copy of all 'g' internal structures.This method is useful to copy a graph into the current without modifying the reference to the current.
'g' internal structures are defensively copied as they are.
- Parameters:
g
- the graph to copy.
-
copyCleaningRedundantLabels
Makes a copy ascopy(TNGraph)
removing all labeled values having unknown literal(s) or -∞ value.- Parameters:
g
- a TNGraph.
-
degree
- Specified by:
degree
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge> - Overrides:
degree
in classedu.uci.ics.jung.graph.AbstractGraph<LabeledNode,
E extends Edge>
-
differentEdgesOf
@Nonnull public it.unimi.dsi.fastutil.objects.ObjectList<it.unimi.dsi.fastutil.objects.ObjectObjectImmutablePair<E,E>> differentEdgesOf(@Nonnull TNGraph<E> g1) Returns the list of different edges of this graph from g1. If an edge is present in one graph and not present in the other, it is reported as different.- Parameters:
g1
- a graph.- Returns:
- list of edges of this graph that are not equal to g1 edges w.r.t. their name and their values, empty immutable list if the two graphs have the same set of edges.
-
findEdge
- Specified by:
findEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge> - Overrides:
findEdge
in classedu.uci.ics.jung.graph.AbstractGraph<LabeledNode,
E extends Edge>
-
findEdge
Find the edge given the names of the source node and the destination node. -
getALabelAlphabet
- Returns:
- the aLabelAlphabet
-
getChildrenOf
Given an observation nodeobs
that observes the proposition 'p', its 'children' are all observation nodes, Q, for which 'p' appears in the label of node Q.This method returns the set of children of a given node as a label of straight propositions associated with the children instead of a set of children nodes.
- Parameters:
obs
- aLabeledNode
object.- Returns:
- the set of children of observation node
obs
, null if there are no children.
-
getContingentNodeCount
public int getContingentNodeCount()- Returns:
- the number of contingent nodes.
-
getDest
WrappergetDest(Edge)
- Parameters:
edgeName
- aString
object.- Returns:
- a
LabeledNode
object.
-
getDest
- Specified by:
getDest
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge> - Specified by:
getDest
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
getEdge
Returns the edge associated with the name.- Parameters:
s
- aString
object.- Returns:
- the edge associated with the name.
-
getEdgeCount
public int getEdgeCount()- Specified by:
getEdgeCount
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
getEdgeFactory
Getter for the fieldedgeFactory
.- Returns:
- the edgeFactory
-
getEdgeImplClass
- Returns:
- the edgeImplementationClass
-
getEdges
Returns an independent collection of the edges of this graph.- Specified by:
getEdges
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
getEdgesAndNodes
@Nonnull public it.unimi.dsi.fastutil.objects.ObjectList<org.apache.commons.lang3.tuple.Triple<LabeledNode,E, getEdgesAndNodes()LabeledNode>> It is an optimization ofgetInEdges(LabeledNode)
that also returns the source node of the incoming edge.- Returns:
- the pair (edge, sourceNode)
-
getEdgesOrdered
- Returns:
- An independent collection of the edges of this graph ordered by name.
-
getEndpoints
getEdgesArray.- Specified by:
getEndpoints
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge>
-
getFileName
- Returns:
- the name of the file that contains this graph.
-
getInEdges
- Specified by:
getInEdges
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge> - Specified by:
getInEdges
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
getInEdgesAndNodes
@Nonnull public it.unimi.dsi.fastutil.objects.ObjectList<it.unimi.dsi.fastutil.objects.ObjectObjectImmutablePair<E,LabeledNode>> getInEdgesAndNodes(@Nonnull LabeledNode vertex) It is an optimization ofgetInEdges(LabeledNode)
that also returns the source node of the incoming edge.- Parameters:
vertex
- the destination node- Returns:
- the pair (edge, sourceNode)
-
getIncidentEdges
@Nonnull public it.unimi.dsi.fastutil.objects.ObjectList<E> getIncidentEdges(@Nonnull LabeledNode vertex) - Specified by:
getIncidentEdges
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
getLowerLabeledEdges
- Returns:
- the list of edges containing Lower Case Labels (when the type of network is CSTNU/CSTPSU). If there are no such edges, it returns an empty list.
-
getName
- Returns:
- the name
-
getNode
Returns the node associated with the name.- Parameters:
s
- aString
object.- Returns:
- the node associated with the name if present, null otherwise.
-
getNeighbors
- Specified by:
getNeighbors
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
getNodesOrdered
- Returns:
- return the set of nodes ordered with respect to the lexicographical order of their names.
- See Also:
-
getNodeFactory
- Returns:
- the nodeFactory
-
getObservedAndObserver
@Nonnull public it.unimi.dsi.fastutil.chars.Char2ObjectMap<LabeledNode> getObservedAndObserver() throws IllegalStateException- Returns:
- the map of propositions and their observers (nodes). If there is no observer node, it returns an empty map.
- Throws:
IllegalStateException
- sanity check: if there are two observers for the same proposition. Such an error should never occur.
-
getObserver
- Parameters:
c
- the proposition- Returns:
- the node that observes the proposition if it exists; otherwise, it is null.
-
getObserver2ZEdges
Be careful! The returned value is not a copy, as the edges are contained!- Returns:
- the list of edges from observers to Z if Z is defined, an empty set otherwise.
-
getOutEdgesAndNodes
@Nonnull public it.unimi.dsi.fastutil.objects.ObjectList<it.unimi.dsi.fastutil.objects.ObjectObjectImmutablePair<E,LabeledNode>> getOutEdgesAndNodes(@Nonnull LabeledNode vertex) It is an optimization ofgetOutEdges(LabeledNode)
that also returns the destination node of the outgoing edge.- Parameters:
vertex
- the source node- Returns:
- the pair (edge,destinationNode)
-
getObserverCount
public int getObserverCount()- Returns:
- the number of observers.
-
getObservers
- Returns:
- the set of observer time-points.
-
getOutEdges
@Nonnull public it.unimi.dsi.fastutil.objects.ObjectList<E> getOutEdges(@Nonnull LabeledNode vertex) - Specified by:
getOutEdges
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge> - Specified by:
getOutEdges
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
getUniqueEdgeName
- Parameters:
edgeName
- a desired name for an edge- Returns:
- name with a possible suffix for making it a name of the new edge without conflicts with the names of already present edges.
-
getPredecessors
- Specified by:
getPredecessors
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge> - Specified by:
getPredecessors
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
getPropositions
@Nonnull public it.unimi.dsi.fastutil.chars.CharSet getPropositions()getPropositions.- Returns:
- the set of propositions of the graph.
-
getSource
- Specified by:
getSource
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge> - Specified by:
getSource
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
getSource
Wrapper ofgetSource(Edge)
- Parameters:
edgeName
- aString
object.- Returns:
- a
LabeledNode
object.
-
getSuccessors
- Specified by:
getSuccessors
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge> - Specified by:
getSuccessors
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
getType
- Returns:
- the type of network
-
getVerticesArray
getVerticesArray.- Returns:
- the array of vertices as an array ordered with respect to the name of the nodes in ascending order.
-
hasSameEdgesOf
Returns true if this graph has the same set of edges as g1.- Parameters:
g1
- a graph.- Returns:
- true if this graph contains edges equal to g1 edges w.r.t. their name and their values. False, otherwise.
-
getUpperLabeledEdges
- Returns:
- the set of edges containing Upper Case Label only for TNGraphs that contain BasicCSTNEdge or derived.
-
getVertexCount
public int getVertexCount()- Specified by:
getVertexCount
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
getVertices
- Specified by:
getVertices
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
hasSameVerticesOf
- Parameters:
g1
- the given graph- Returns:
- true if g1 has the set of vertices equal to the set of vertices of this.
-
getZ
- Returns:
- the Z node
-
makeNewEdge
Creates a new edge proper for this graph using edgeName as a proposed name (it will be modified by adding a suffix if there is already another edge with name edgeName) and setting the type to type.- Parameters:
edgeName
- the proposed name for the edge.edgeType
- the type of the edge.- Returns:
- a new edge (without adding it to the graph) of the proper class for this graph.
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-
removeEdge
Removes the edge from this graph and clears all cache data structures that could contain the removed edge.- Parameters:
edgeName
- aString
object.- Returns:
- true if the edge was removed, false if the edge is not present.
-
inDegree
- Specified by:
inDegree
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge> - Specified by:
inDegree
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge> - Overrides:
inDegree
in classedu.uci.ics.jung.graph.AbstractGraph<LabeledNode,
E extends Edge>
-
isDest
- Specified by:
isDest
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge>
-
isSource
- Specified by:
isSource
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge>
-
removeVertex
Removes the given node and all edges having it as an endpoint.- Specified by:
removeVertex
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge> - Returns:
- true if the node was removed, false if the node was not present and, therefore, not removed.
-
outDegree
- Specified by:
outDegree
in interfaceedu.uci.ics.jung.graph.Graph<LabeledNode,
E extends Edge> - Specified by:
outDegree
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge> - Overrides:
outDegree
in classedu.uci.ics.jung.graph.AbstractGraph<LabeledNode,
E extends Edge>
-
setName
- Parameters:
graphName
- the name to set
-
removeEdge
- Specified by:
removeEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<LabeledNode,
E extends Edge>
-
setType
Sets the type of network.
Warning: this method was introduced for setting the PSTN type because it is not simple to determine it from the kind of edges. Don't use this method for other types because the constructor sets the type automatically. Changing the type of network after its creation can make many edge properties unreadable.- Parameters:
type
- is a new type for the network.
-
removeEmptyEdges
public boolean removeEmptyEdges()Removes all empty edges in the graph.- Returns:
- true if at least one edge was removed.
-
setZ
Setsz
as the first node (Zero node) of the temporal constraint network.- Parameters:
z
- the node to be set as the Z node of the network. If z is null, then the Z information is nullified.
-
reverse
public void reverse()Reverse (transpose) the current graph. -
setAllPotential
public void setAllPotential(int v) Sets the potential of each node tov
.- Parameters:
v
- new potential value
-
setInputFile
- Parameters:
file
- aFile
object.
-
takeFrom
Takes from g1 all its internal structures.
This method is useful for copying the references of the internal data structure of the given graph 'g' into the current.
After this method, the internal structures with input g are shared.- Parameters:
g1
- the graph to cannibalize.
-
toString
- Overrides:
toString
in classedu.uci.ics.jung.graph.AbstractGraph<LabeledNode,
E extends Edge>
-
transpose
public void transpose()Transposesthis
, inverting only the source/destination of each edge. All other attributes of an edge are not modified.
-