Class ManualLagGraph

java.lang.Object
edu.cmu.tetrad.gene.tetrad.gene.graph.ManualLagGraph
All Implemented Interfaces:
LagGraph, TetradSerializable, Serializable

public final class ManualLagGraph extends Object implements LagGraph
Constructs as a (manual) update graph.
See Also:
  • Constructor Details

    • ManualLagGraph

      public ManualLagGraph(ManualLagGraphParams params)
      Using the given parameters, constructs an BasicLagGraph.
      Parameters:
      params - an LagGraphParams object.
  • Method Details

    • serializableInstance

      public static ManualLagGraph serializableInstance()
      Generates a simple exemplar of this class to test serialization.
    • addEdge

      public void addEdge(String factor, LaggedFactor laggedFactor) throws IllegalArgumentException
      Description copied from interface: LagGraph
      Adds an edge to the given factor at lag 0 from the specified lagged factor.
      Specified by:
      addEdge in interface LagGraph
      Parameters:
      factor - a factor name in the graph.
      laggedFactor - a lagged factor with factor name in the graph and lag >=1.
      Throws:
      IllegalArgumentException - if the edge cannot be added.
    • clearEdges

      public void clearEdges()
      Description copied from interface: LagGraph
      Removes all edges from the graph.
      Specified by:
      clearEdges in interface LagGraph
    • addFactor

      public void addFactor(String factor)
      Description copied from interface: LagGraph
      Adds a factor to the graph. If the factor is already in the graph, no action is taken.
      Specified by:
      addFactor in interface LagGraph
      Parameters:
      factor - the factor (name).
    • existsFactor

      public boolean existsFactor(String factor)
      Description copied from interface: LagGraph
      Determines whether the given factor exists in the graph.
      Specified by:
      existsFactor in interface LagGraph
      Parameters:
      factor - the given factor.
      Returns:
      true if the given factor is in the graph, false if not.
    • existsEdge

      public boolean existsEdge(String factor, LaggedFactor laggedFactor)
      Description copied from interface: LagGraph
      Determines whether the edge to 'factor' at time lag 0 from 'laggedFactor' exists in the graph.
      Specified by:
      existsEdge in interface LagGraph
      Parameters:
      factor - the "to" factor.
      laggedFactor - the "from" factor at the given lag.
      Returns:
      true if this edge exists in the graph, false if not.
    • getParents

      public SortedSet getParents(String factor)
      Description copied from interface: LagGraph
      Returns the lagged factors which are into the given factor.
      Specified by:
      getParents in interface LagGraph
      Parameters:
      factor - the "into" factor.
      Returns:
      the set of lagged factors into this factor.
    • removeEdge

      public void removeEdge(String factor, LaggedFactor laggedFactor)
      Description copied from interface: LagGraph
      Removes the lagged factor from the list of lagged factors associated with the given factor.
      Specified by:
      removeEdge in interface LagGraph
      Parameters:
      factor - the "into" factor.
      laggedFactor - the "outof" lagged factor.
    • getMaxLagAllowable

      public int getMaxLagAllowable()
      Description copied from interface: LagGraph
      Gets the maximum allowable lag. Edges may not be added with lags greated than this.
      Specified by:
      getMaxLagAllowable in interface LagGraph
    • setMaxLagAllowable

      public void setMaxLagAllowable(int maxLagAllowable)
      Description copied from interface: LagGraph
      Sets the maximum allowable lag. Edges may not be added with lags greater than this. This value must be >= the getModel value of getMaxLag().
      Specified by:
      setMaxLagAllowable in interface LagGraph
    • getMaxLag

      public int getMaxLag()
      Description copied from interface: LagGraph
      Maximum lag needed to fully represent the graph, which is the largest lag of any of the lagged factors stored in the graph.
      Specified by:
      getMaxLag in interface LagGraph
      Returns:
      the maximum lag in the mdoel.
    • removeFactor

      public void removeFactor(String factor)
      Description copied from interface: LagGraph
      Removes a factor from the graph.
      Specified by:
      removeFactor in interface LagGraph
      Parameters:
      factor - the name of the factor.
    • getConnectivity

      public SortedMap getConnectivity()
      Description copied from interface: LagGraph
      Returns (a copy of) the sorted map from factors to lagged factors which internally encodes the update graph. The purpose of this method is to allow update functions to store a copy of their own connectivity in a way which does not depend on the original update graph staying the way it is. The way to do this is to use this method to get a copy of the connectivity to store internally in the update function. Because it is a SortedMap, factors and lagged factors can be expected to stay in the same order.

      Note: This strategy is not implemented yet! Please remove this note when it is implemented. The idea is to get rid of the classes IndexedParent and Connectivity and use this sorted map to replace them.

      Specified by:
      getConnectivity in interface LagGraph
      Returns:
      this sorted map.
    • renameFactor

      public void renameFactor(String oldName, String newName)
      Description copied from interface: LagGraph
      Renames a factor, changing all occurances of the old name to the new one
      Specified by:
      renameFactor in interface LagGraph
    • getNumFactors

      public int getNumFactors()
      Description copied from interface: LagGraph
      Returns the number of factors represented in the graph.
      Specified by:
      getNumFactors in interface LagGraph
      Returns:
      this number.
    • getFactors

      public SortedSet getFactors()
      Description copied from interface: LagGraph
      Returns a SortedSet of the factors in this graph.
      Specified by:
      getFactors in interface LagGraph
      Returns:
      this set.
    • toString

      public String toString()
      Description copied from interface: LagGraph
      Returns a string representation of the graph, indicating for each factor which lagged factors map into it.
      Specified by:
      toString in interface LagGraph
      Overrides:
      toString in class Object
      Returns:
      this string.
    • addFactors

      public void addFactors(String base, int numFactors)
      Specified by:
      addFactors in interface LagGraph
    • setLocation

      public void setLocation(String factor, PointXy point)
      Specified by:
      setLocation in interface LagGraph
    • getLocation

      public PointXy getLocation(String factor)
      Specified by:
      getLocation in interface LagGraph
    • getLocations

      public Map getLocations()
      Specified by:
      getLocations in interface LagGraph