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:
  • Field Details

    • growFactor

      static final float growFactor
      Adjacency 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

      public TNGraph(@Nonnull String graphName, @Nonnull Class<E1> inputEdgeImplClass)
      Constructor for TNGraph.
      Type Parameters:
      E1 - type of edge
      Parameters:
      graphName - a name for the graph
      inputEdgeImplClass - 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 graph
      inputEdgeImplClass - type of edges
      alphabet - 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 by TNEditor because all listener about nodes and edges are not activated.
      Type Parameters:
      E1 - type of edge
      Parameters:
      inputGraph - the graph to be cloned
      edgeImplClass - class
      sameNodes - 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

      public TNGraph(@Nonnull TNGraph<E> inputGraph, @Nonnull Class<E1> edgeImplClass)
      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 cloned
      edgeImplClass - class
  • Method Details

    • unmodifiable

      @Nonnull public static <K extends Edge> TNGraph.UnmodifiableTNGraph<K> unmodifiable(TNGraph<K> g)
      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

      public void addChildToObserverNode(@Nonnull LabeledNode obs, char child)
      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 - a LabeledNode object.
      child - a char.
    • addEdge

      public boolean addEdge(@Nonnull E e, @Nonnull LabeledNode v1, @Nonnull LabeledNode v2)
      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 calls addEdge(Edge, String, String) method.
      Specified by:
      addEdge in interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
      Overrides:
      addEdge in class edu.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 interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
      Overrides:
      addEdge in class edu.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 class edu.uci.ics.jung.graph.AbstractGraph<LabeledNode,E extends Edge>
    • addEdge

      public boolean addEdge(@Nonnull E edge, @Nonnull Collection<? extends LabeledNode> vertices)
      Unsupported
      Specified by:
      addEdge in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
      Overrides:
      addEdge in class edu.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 interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
      Overrides:
      addEdge in class edu.uci.ics.jung.graph.AbstractGraph<LabeledNode,E extends Edge>
    • addEdge

      public void addEdge(@Nonnull E e, @Nonnull String v1Name, @Nonnull String v2Name)
      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 null
      v1Name - not null
      v2Name - 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 class edu.uci.ics.jung.graph.AbstractGraph<LabeledNode,E extends Edge>
    • addEdgeWithoutCheck

      public void addEdgeWithoutCheck(@Nonnull E e, @Nonnull String v1Name, @Nonnull String v2Name)
      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 by TNEditor 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 null
      v1Name - not null
      v2Name - 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

      public boolean addVertex(@Nonnull LabeledNode vertex)
      Adds the given vertex to the graph.
      Specified by:
      addVertex in interface edu.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

      public void addVertexWithoutCheck(@Nonnull LabeledNode vertex)
      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

      public boolean containsEdge(@Nonnull E edge)
      Specified by:
      containsEdge in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • containsVertex

      public boolean containsVertex(@Nonnull LabeledNode vertex)
      Specified by:
      containsVertex in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • copy

      public void copy(@Nonnull TNGraph<E> g)
      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

      public void copyCleaningRedundantLabels(@Nonnull TNGraph<E> g)
      Makes a copy as copy(TNGraph) removing all labeled values having unknown literal(s) or -∞ value.
      Parameters:
      g - a TNGraph.
    • degree

      public int degree(@Nonnull LabeledNode vertex)
      Specified by:
      degree in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
      Overrides:
      degree in class edu.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

      @Nullable public E findEdge(@Nullable LabeledNode s, @Nullable LabeledNode d)
      Specified by:
      findEdge in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
      Overrides:
      findEdge in class edu.uci.ics.jung.graph.AbstractGraph<LabeledNode,E extends Edge>
    • findEdge

      @Nullable public E findEdge(String s, String d)
      Find the edge given the names of the source node and the destination node.
      Parameters:
      s - a String object.
      d - a String object.
      Returns:
      null if any parameter is null or if there does not exist at least one of the two nodes or the edge does not exist.
    • getALabelAlphabet

      public ALabelAlphabet getALabelAlphabet()
      Returns:
      the aLabelAlphabet
    • getChildrenOf

      @Nullable public Label getChildrenOf(@Nonnull LabeledNode obs)
      Given an observation node obs 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 - a LabeledNode 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

      @Nullable public LabeledNode getDest(@Nonnull String edgeName)
      Parameters:
      edgeName - a String object.
      Returns:
      a LabeledNode object.
    • getDest

      @Nullable public LabeledNode getDest(@Nonnull E directedEdge)
      Specified by:
      getDest in interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
      Specified by:
      getDest in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • getEdge

      @Nullable public E getEdge(@Nonnull String s)
      Returns the edge associated with the name.
      Parameters:
      s - a String object.
      Returns:
      the edge associated with the name.
    • getEdgeCount

      public int getEdgeCount()
      Specified by:
      getEdgeCount in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • getEdgeFactory

      public EdgeSupplier<E> getEdgeFactory()
      Getter for the field edgeFactory.
      Returns:
      the edgeFactory
    • getEdgeImplClass

      public Class<? extends E> getEdgeImplClass()
      Returns:
      the edgeImplementationClass
    • getEdges

      @Nonnull public Collection<E> getEdges()
      Returns an independent collection of the edges of this graph.
      Specified by:
      getEdges in interface edu.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,LabeledNode>> getEdgesAndNodes()
      It is an optimization of getInEdges(LabeledNode) that also returns the source node of the incoming edge.
      Returns:
      the pair (edge, sourceNode)
    • getEdgesOrdered

      @Nonnull public Collection<E> getEdgesOrdered()
      Returns:
      An independent collection of the edges of this graph ordered by name.
    • getEndpoints

      @Nullable public edu.uci.ics.jung.graph.util.Pair<LabeledNode> getEndpoints(@Nonnull E edge)
      getEdgesArray.
      Specified by:
      getEndpoints in interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
    • getFileName

      public File getFileName()
      Returns:
      the name of the file that contains this graph.
    • getInEdges

      @Nonnull public it.unimi.dsi.fastutil.objects.ObjectList<E> getInEdges(@Nonnull LabeledNode vertex)
      Specified by:
      getInEdges in interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
      Specified by:
      getInEdges in interface edu.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 of getInEdges(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 interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • getLowerLabeledEdges

      @Nonnull public it.unimi.dsi.fastutil.objects.ObjectList<BasicCSTNUEdge> 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

      public String getName()
      Returns:
      the name
    • getNode

      @Nullable public LabeledNode getNode(@Nonnull String s)
      Returns the node associated with the name.
      Parameters:
      s - a String object.
      Returns:
      the node associated with the name if present, null otherwise.
    • getNeighbors

      @Nullable public Collection<LabeledNode> getNeighbors(@Nonnull LabeledNode vertex)
      Specified by:
      getNeighbors in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • getNodesOrdered

      @Nonnull public Collection<LabeledNode> getNodesOrdered()
      Returns:
      return the set of nodes ordered with respect to the lexicographical order of their names.
      See Also:
    • getNodeFactory

      public LabeledNodeSupplier 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

      @Nullable public LabeledNode getObserver(char c)
      Parameters:
      c - the proposition
      Returns:
      the node that observes the proposition if it exists; otherwise, it is null.
    • getObserver2ZEdges

      @Nonnull public it.unimi.dsi.fastutil.objects.ObjectList<E> 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 of getOutEdges(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

      @Nonnull public Collection<LabeledNode> 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 interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
      Specified by:
      getOutEdges in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • getUniqueEdgeName

      public String getUniqueEdgeName(@Nonnull String edgeName)
      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

      @Nonnull public Collection<LabeledNode> getPredecessors(@Nonnull LabeledNode vertex)
      Specified by:
      getPredecessors in interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
      Specified by:
      getPredecessors in interface edu.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

      @Nullable public LabeledNode getSource(@Nonnull E edge)
      Specified by:
      getSource in interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
      Specified by:
      getSource in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • getSource

      @Nullable public LabeledNode getSource(@Nonnull String edgeName)
      Wrapper of getSource(Edge)
      Parameters:
      edgeName - a String object.
      Returns:
      a LabeledNode object.
    • getSuccessors

      @Nonnull public Collection<LabeledNode> getSuccessors(@Nonnull LabeledNode vertex)
      Specified by:
      getSuccessors in interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
      Specified by:
      getSuccessors in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • getType

      public TNGraph.NetworkType getType()
      Returns:
      the type of network
    • getVerticesArray

      public LabeledNode[] getVerticesArray()
      getVerticesArray.
      Returns:
      the array of vertices as an array ordered with respect to the name of the nodes in ascending order.
    • hasSameEdgesOf

      public boolean hasSameEdgesOf(@Nonnull TNGraph<E> g1)
      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

      public Set<BasicCSTNUEdge> 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 interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • getVertices

      @Nonnull public Collection<LabeledNode> getVertices()
      Specified by:
      getVertices in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • hasSameVerticesOf

      public boolean hasSameVerticesOf(@Nonnull TNGraph<E> g1)
      Parameters:
      g1 - the given graph
      Returns:
      true if g1 has the set of vertices equal to the set of vertices of this.
    • getZ

      @Nullable public LabeledNode getZ()
      Returns:
      the Z node
    • makeNewEdge

      public E makeNewEdge(@Nonnull String edgeName, @Nonnull 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.
      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

      public void propertyChange(@Nonnull PropertyChangeEvent pce)
      Specified by:
      propertyChange in interface PropertyChangeListener
    • removeEdge

      public boolean removeEdge(@Nonnull String edgeName)
      Removes the edge from this graph and clears all cache data structures that could contain the removed edge.
      Parameters:
      edgeName - a String object.
      Returns:
      true if the edge was removed, false if the edge is not present.
    • inDegree

      public int inDegree(@Nonnull LabeledNode vertex)
      Specified by:
      inDegree in interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
      Specified by:
      inDegree in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
      Overrides:
      inDegree in class edu.uci.ics.jung.graph.AbstractGraph<LabeledNode,E extends Edge>
    • isDest

      public boolean isDest(@Nonnull LabeledNode vertex, @Nonnull E edge)
      Specified by:
      isDest in interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
    • isSource

      public boolean isSource(@Nonnull LabeledNode vertex, @Nonnull E edge)
      Specified by:
      isSource in interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
    • removeVertex

      public boolean removeVertex(@Nonnull LabeledNode removingNode)
      Removes the given node and all edges having it as an endpoint.
      Specified by:
      removeVertex in interface edu.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

      public int outDegree(@Nonnull LabeledNode vertex)
      Specified by:
      outDegree in interface edu.uci.ics.jung.graph.Graph<LabeledNode,E extends Edge>
      Specified by:
      outDegree in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
      Overrides:
      outDegree in class edu.uci.ics.jung.graph.AbstractGraph<LabeledNode,E extends Edge>
    • setName

      public void setName(@Nonnull String graphName)
      Parameters:
      graphName - the name to set
    • removeEdge

      public boolean removeEdge(@Nonnull E edge)
      Specified by:
      removeEdge in interface edu.uci.ics.jung.graph.Hypergraph<LabeledNode,E extends Edge>
    • setType

      public 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. 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

      public void setZ(@Nullable LabeledNode z)
      Sets z 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 to v.
      Parameters:
      v - new potential value
    • setInputFile

      public void setInputFile(File file)
      Parameters:
      file - a File object.
    • takeFrom

      public void takeFrom(@Nonnull TNGraph<? extends E> g1)
      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

      @Nonnull public String toString()
      Overrides:
      toString in class edu.uci.ics.jung.graph.AbstractGraph<LabeledNode,E extends Edge>
    • transpose

      public void transpose()
      Transposes this, inverting only the source/destination of each edge. All other attributes of an edge are not modified.