Class ManualLagGraph
java.lang.Object
edu.cmu.tetrad.gene.tetrad.gene.graph.ManualLagGraph
- All Implemented Interfaces:
LagGraph,TetradSerializable,Serializable
Constructs as a (manual) update graph.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionManualLagGraph(ManualLagGraphParams params) Using the given parameters, constructs an BasicLagGraph. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEdge(String factor, LaggedFactor laggedFactor) Adds an edge to the given factor at lag 0 from the specified lagged factor.voidAdds a factor to the graph.voidaddFactors(String base, int numFactors) voidRemoves all edges from the graph.booleanexistsEdge(String factor, LaggedFactor laggedFactor) Determines whether the edge to 'factor' at time lag 0 from 'laggedFactor' exists in the graph.booleanexistsFactor(String factor) Determines whether the given factor exists in the graph.Returns (a copy of) the sorted map from factors to lagged factors which internally encodes the update graph.Returns a SortedSet of the factors in this graph.getLocation(String factor) intMaximum lag needed to fully represent the graph, which is the largest lag of any of the lagged factors stored in the graph.intGets the maximum allowable lag.intReturns the number of factors represented in the graph.getParents(String factor) Returns the lagged factors which are into the given factor.voidremoveEdge(String factor, LaggedFactor laggedFactor) Removes the lagged factor from the list of lagged factors associated with the given factor.voidremoveFactor(String factor) Removes a factor from the graph.voidrenameFactor(String oldName, String newName) Renames a factor, changing all occurances of the old name to the new onestatic ManualLagGraphGenerates a simple exemplar of this class to test serialization.voidsetLocation(String factor, PointXy point) voidsetMaxLagAllowable(int maxLagAllowable) Sets the maximum allowable lag.toString()Returns a string representation of the graph, indicating for each factor which lagged factors map into it.
-
Constructor Details
-
ManualLagGraph
Using the given parameters, constructs an BasicLagGraph.- Parameters:
params- an LagGraphParams object.
-
-
Method Details
-
serializableInstance
Generates a simple exemplar of this class to test serialization. -
addEdge
Description copied from interface:LagGraphAdds an edge to the given factor at lag 0 from the specified lagged factor.- Specified by:
addEdgein interfaceLagGraph- 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:LagGraphRemoves all edges from the graph.- Specified by:
clearEdgesin interfaceLagGraph
-
addFactor
Description copied from interface:LagGraphAdds a factor to the graph. If the factor is already in the graph, no action is taken. -
existsFactor
Description copied from interface:LagGraphDetermines whether the given factor exists in the graph.- Specified by:
existsFactorin interfaceLagGraph- Parameters:
factor- the given factor.- Returns:
- true if the given factor is in the graph, false if not.
-
existsEdge
Description copied from interface:LagGraphDetermines whether the edge to 'factor' at time lag 0 from 'laggedFactor' exists in the graph.- Specified by:
existsEdgein interfaceLagGraph- 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
Description copied from interface:LagGraphReturns the lagged factors which are into the given factor.- Specified by:
getParentsin interfaceLagGraph- Parameters:
factor- the "into" factor.- Returns:
- the set of lagged factors into this factor.
-
removeEdge
Description copied from interface:LagGraphRemoves the lagged factor from the list of lagged factors associated with the given factor.- Specified by:
removeEdgein interfaceLagGraph- Parameters:
factor- the "into" factor.laggedFactor- the "outof" lagged factor.
-
getMaxLagAllowable
public int getMaxLagAllowable()Description copied from interface:LagGraphGets the maximum allowable lag. Edges may not be added with lags greated than this.- Specified by:
getMaxLagAllowablein interfaceLagGraph
-
setMaxLagAllowable
public void setMaxLagAllowable(int maxLagAllowable) Description copied from interface:LagGraphSets 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:
setMaxLagAllowablein interfaceLagGraph
-
getMaxLag
public int getMaxLag()Description copied from interface:LagGraphMaximum lag needed to fully represent the graph, which is the largest lag of any of the lagged factors stored in the graph. -
removeFactor
Description copied from interface:LagGraphRemoves a factor from the graph.- Specified by:
removeFactorin interfaceLagGraph- Parameters:
factor- the name of the factor.
-
getConnectivity
Description copied from interface:LagGraphReturns (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:
getConnectivityin interfaceLagGraph- Returns:
- this sorted map.
-
renameFactor
Description copied from interface:LagGraphRenames a factor, changing all occurances of the old name to the new one- Specified by:
renameFactorin interfaceLagGraph
-
getNumFactors
public int getNumFactors()Description copied from interface:LagGraphReturns the number of factors represented in the graph.- Specified by:
getNumFactorsin interfaceLagGraph- Returns:
- this number.
-
getFactors
Description copied from interface:LagGraphReturns a SortedSet of the factors in this graph.- Specified by:
getFactorsin interfaceLagGraph- Returns:
- this set.
-
toString
Description copied from interface:LagGraphReturns a string representation of the graph, indicating for each factor which lagged factors map into it. -
addFactors
- Specified by:
addFactorsin interfaceLagGraph
-
setLocation
- Specified by:
setLocationin interfaceLagGraph
-
getLocation
- Specified by:
getLocationin interfaceLagGraph
-
getLocations
- Specified by:
getLocationsin interfaceLagGraph
-