Package edu.cmu.tetrad.graph
Class LagGraph
java.lang.Object
edu.cmu.tetrad.graph.LagGraph
- All Implemented Interfaces:
- Graph,- TetradSerializable,- Serializable
Implements a graph allowing nodes in the getModel time lag to have parents
 taken from previous time lags. This is intended to be interpreted as a
 repeating time series graph for purposes of simulation.
- Author:
- Joseph Ramsey
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddAttribute(String key, Object value) booleanaddBidirectedEdge(Node node1, Node node2) Adds a bidirected edges <-> to the graph.booleanaddDirectedEdge(Node node1, Node node2) Adds a directed edge --> to the graph.booleanAdds the specified edge to the graph, provided it is not already in the graph.booleanAdds a node to the graph.booleanaddNondirectedEdge(Node node1, Node node2) Adds a nondirected edges o-o to the graph.booleanaddPartiallyOrientedEdge(Node node1, Node node2) Adds a partially oriented edge o-> to the graph.voidAdds a PropertyChangeListener to the graph.booleanaddUndirectedEdge(Node node1, Node node2) Adds an undirected edge --- to the graph.booleanaddVariable(String variable) voidclear()Removes all nodes (and therefore all edges) from the graph.booleancontainsEdge(Edge edge) Determines whether this graph contains the given edge.booleancontainsNode(Node node) Determines whether this graph contains the given node.voidfullyConnect(Endpoint endpoint) Removes all edges from the graph and fully connects it using #-# edges, where # is the given endpoint.getAdjacentNodes(Node node) getAttribute(String key) getChildren(Node node) intintgetDirectedEdge(Node node1, Node node2) getEdges()getEndpoint(Node node1, Node node2) intgetIndegree(Node node) getNodes()getNodesInTo(Node node, Endpoint n) Nodes adjacent to the given node with the given proximal endpoint.getNodesOutTo(Node node, Endpoint n) Nodes adjacent to the given node with the given distal endpoint.intintgetNumEdges(Node node) intintgetOutdegree(Node node) getParents(Node node) booleanisAdjacentTo(Node node1, Node node2) booleanisAncestorOf(Node node1, Node node2) booleanbooleanisDefCollider(Node node1, Node node2, Node node3) Added by ekorber, 2004/6/9.booleanisDefNoncollider(Node node1, Node node2, Node node3) Added by ekorber, 2004/6/9.booleanisExogenous(Node node) booleanisParameterizable(Node node) booleanisParentOf(Node node1, Node node2) Determines whether node1 is a parent of node2.booleanpaths()voidremoveAttribute(String key) booleanremoveEdge(Edge edge) Removes the given edge from the graph.booleanremoveEdge(Node node1, Node node2) Removes the edge connecting the two given nodes, provided there is exactly one such edge.booleanremoveEdges(Node node1, Node node2) Removes all edges connecting node A to node B.booleanremoveEdges(Collection<Edge> edges) Iterates through the list and removes any permissible edges found.booleanremoveNode(Node node) Removes a node from the graph.booleanremoveNodes(List<Node> nodes) Iterates through the list and removes any permissible nodes found.voidreorientAllWith(Endpoint endpoint) Reorients all edges in the graph with the given endpoint.static LagGraphGenerates a simple exemplar of this class to test serialization.booleansetEndpoint(Node from, Node to, Endpoint endPoint) Sets the endpoint type at the 'to' end of the edge from 'from' to 'to' to the given endpoint.voidvoidConstructs and returns a subgraph consisting of a given subset of the nodes of this graph together with the edges between them.voidtransferAttributes(Graph graph) voidtransferNodesAndEdges(Graph graph) Transfers nodes and edges from one graph to another.
- 
Constructor Details- 
LagGraphpublic LagGraph()
 
- 
- 
Method Details- 
addVariable
- 
serializableInstanceGenerates a simple exemplar of this class to test serialization.
- 
addDirectedEdgeDescription copied from interface:GraphAdds a directed edge --> to the graph.- Specified by:
- addDirectedEdgein interface- Graph
 
- 
addNodeDescription copied from interface:GraphAdds a node to the graph. Precondition: The proposed name of the node cannot already be used by any other node in the same graph.
- 
addBidirectedEdgeDescription copied from interface:GraphAdds a bidirected edges <-> to the graph.- Specified by:
- addBidirectedEdgein interface- Graph
 
- 
addUndirectedEdgeDescription copied from interface:GraphAdds an undirected edge --- to the graph.- Specified by:
- addUndirectedEdgein interface- Graph
 
- 
addNondirectedEdgeDescription copied from interface:GraphAdds a nondirected edges o-o to the graph.- Specified by:
- addNondirectedEdgein interface- Graph
 
- 
addPartiallyOrientedEdgeDescription copied from interface:GraphAdds a partially oriented edge o-> to the graph.- Specified by:
- addPartiallyOrientedEdgein interface- Graph
 
- 
addEdgeDescription copied from interface:GraphAdds the specified edge to the graph, provided it is not already in the graph.
- 
addPropertyChangeListenerDescription copied from interface:GraphAdds a PropertyChangeListener to the graph.- Specified by:
- addPropertyChangeListenerin interface- Graph
 
- 
clearpublic void clear()Description copied from interface:GraphRemoves all nodes (and therefore all edges) from the graph.
- 
containsEdgeDescription copied from interface:GraphDetermines whether this graph contains the given edge.- Specified by:
- containsEdgein interface- Graph
- Returns:
- true iff the graph contain 'edge'.
 
- 
containsNodeDescription copied from interface:GraphDetermines whether this graph contains the given node.- Specified by:
- containsNodein interface- Graph
- Returns:
- true iff the graph contains 'node'.
 
- 
fullyConnectDescription copied from interface:GraphRemoves all edges from the graph and fully connects it using #-# edges, where # is the given endpoint.- Specified by:
- fullyConnectin interface- Graph
 
- 
reorientAllWithDescription copied from interface:GraphReorients all edges in the graph with the given endpoint.- Specified by:
- reorientAllWithin interface- Graph
 
- 
getAdjacentNodes- Specified by:
- getAdjacentNodesin interface- Graph
- Returns:
- a mutable list of nodes adjacent to the given node.
 
- 
getChildren- Specified by:
- getChildrenin interface- Graph
- Returns:
- a mutable list of children for a node.
 
- 
getDegreepublic int getDegree()
- 
getEdge
- 
getDirectedEdge- Specified by:
- getDirectedEdgein interface- Graph
- Returns:
- the directed edge from node1 to node2, if there is one.
 
- 
getEdges
- 
getEdges
- 
getEdges
- 
getEndpoint- Specified by:
- getEndpointin interface- Graph
- Returns:
- the endpoint along the edge from node to node2 at the node2 end.
 
- 
getIndegree- Specified by:
- getIndegreein interface- Graph
- Returns:
- the number of arrow endpoints adjacent to a node.
 
- 
getDegree
- 
getNode
- 
getNodes
- 
getNodeNames- Specified by:
- getNodeNamesin interface- Graph
- Returns:
- the names of the nodes, in the order of getNodes.
 
- 
getNumEdgespublic int getNumEdges()- Specified by:
- getNumEdgesin interface- Graph
- Returns:
- the number of edges in the (entire) graph.
 
- 
getNumEdges- Specified by:
- getNumEdgesin interface- Graph
- Returns:
- the number of edges in the graph which are connected to a particular node.
 
- 
getNumNodespublic int getNumNodes()- Specified by:
- getNumNodesin interface- Graph
- Returns:
- the number of nodes in the graph.
 
- 
getOutdegree- Specified by:
- getOutdegreein interface- Graph
- Returns:
- the number of null endpoints adjacent to an edge.
 
- 
getParents- Specified by:
- getParentsin interface- Graph
- Returns:
- the list of parents for a node.
 
- 
isAdjacentTo- Specified by:
- isAdjacentToin interface- Graph
- Returns:
- true iff node1 is adjacent to node2 in the graph.
 
- 
isAncestorOf
- 
isChildOf
- 
isParentOfDescription copied from interface:GraphDetermines whether node1 is a parent of node2.- Specified by:
- isParentOfin interface- Graph
 
- 
isDefNoncolliderDescription copied from interface:GraphAdded by ekorber, 2004/6/9.- Specified by:
- isDefNoncolliderin interface- Graph
- Returns:
- true if node 2 is a definite noncollider between 1 and 3
 
- 
isDefColliderDescription copied from interface:GraphAdded by ekorber, 2004/6/9.- Specified by:
- isDefColliderin interface- Graph
- Returns:
- true if node 2 is a definite collider between 1 and 3
 
- 
isExogenous- Specified by:
- isExogenousin interface- Graph
- Returns:
- true iff the given node is exogenous in the graph.
 
- 
getNodesInToDescription copied from interface:GraphNodes adjacent to the given node with the given proximal endpoint.- Specified by:
- getNodesInToin interface- Graph
 
- 
getNodesOutToDescription copied from interface:GraphNodes adjacent to the given node with the given distal endpoint.- Specified by:
- getNodesOutToin interface- Graph
 
- 
removeEdgeDescription copied from interface:GraphRemoves the given edge from the graph.- Specified by:
- removeEdgein interface- Graph
- Returns:
- true if the edge was removed, false if not.
 
- 
removeEdgeDescription copied from interface:GraphRemoves the edge connecting the two given nodes, provided there is exactly one such edge.- Specified by:
- removeEdgein interface- Graph
 
- 
removeEdgesDescription copied from interface:GraphRemoves all edges connecting node A to node B. In most cases, this will remove at most one edge, but since multiple edges are permitted in some graph implementations, the number will in some cases be greater than one.- Specified by:
- removeEdgesin interface- Graph
- Returns:
- true if edges were removed, false if not.
 
- 
removeEdgesDescription copied from interface:GraphIterates through the list and removes any permissible edges found. The order in which edges are added is the order in which they are presented in the iterator.- Specified by:
- removeEdgesin interface- Graph
- Returns:
- true if edges were added, false if not.
 
- 
removeNodeDescription copied from interface:GraphRemoves a node from the graph.- Specified by:
- removeNodein interface- Graph
- Returns:
- true if the node was removed, false if not.
 
- 
removeNodesDescription copied from interface:GraphIterates through the list and removes any permissible nodes found. The order in which nodes are removed is the order in which they are presented in the iterator.- Specified by:
- removeNodesin interface- Graph
- Returns:
- true if nodes were added, false if not.
 
- 
setEndpointDescription copied from interface:GraphSets the endpoint type at the 'to' end of the edge from 'from' to 'to' to the given endpoint. Note: NOT CONSTRAINT SAFE- Specified by:
- setEndpointin interface- Graph
 
- 
subgraphDescription copied from interface:GraphConstructs and returns a subgraph consisting of a given subset of the nodes of this graph together with the edges between them.
- 
transferNodesAndEdgesDescription copied from interface:GraphTransfers nodes and edges from one graph to another. One way this is used is to change graph types. One constructs a new graph based on the old graph, and this method is called to transfer the nodes and edges of the old graph to the new graph.- Specified by:
- transferNodesAndEdgesin interface- Graph
- Parameters:
- graph- the graph from which nodes and edges are to be pilfered.
- Throws:
- IllegalArgumentException- This exception is thrown if adding some node.
 
- 
transferAttributes- Specified by:
- transferAttributesin interface- Graph
- Throws:
- IllegalArgumentException
 
- 
underlines- Specified by:
- underlinesin interface- Graph
 
- 
paths
- 
isParameterizable- Specified by:
- isParameterizablein interface- Graph
- Returns:
- true if the given node is parameterizable.
 
- 
isTimeLagModelpublic boolean isTimeLagModel()- Specified by:
- isTimeLagModelin interface- Graph
- Returns:
- true if this is a time lag model, in which case getTimeLagGraph() returns the graph.
 
- 
getTimeLagGraph- Specified by:
- getTimeLagGraphin interface- Graph
- Returns:
- the underlying time lag model, if there is one; otherwise, returns null.
 
- 
getSepset
- 
setNodes
- 
setGraph
- 
getAllAttributes- Specified by:
- getAllAttributesin interface- Graph
 
- 
getAttribute- Specified by:
- getAttributein interface- Graph
 
- 
removeAttribute- Specified by:
- removeAttributein interface- Graph
 
- 
addAttribute- Specified by:
- addAttributein interface- Graph
 
 
-