Class LagGraph
- All Implemented Interfaces:
Graph,TetradSerializable,Serializable
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAmbiguousTriple(Node x, Node y, Node z) addAmbiguousTriple.voidaddAttribute(String key, Object value) addAttribute.booleanaddBidirectedEdge(Node node1, Node node2) Adds a bidirected edges <-> to the graph.booleanaddDirectedEdge(Node node1, Node node2) Adds a directed edge --> to the graph.voidaddDottedUnderlineTriple(Node x, Node y, Node z) addDottedUnderlineTriple.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.voidaddUnderlineTriple(Node x, Node y, Node z) addUnderlineTriple.booleanaddUndirectedEdge(Node node1, Node node2) Adds an undirected edge --- to the graph.booleanaddVariable(String variable) addVariable.voidclear()clear.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) getAdjacentNodes.getAllAttributes.Getter for the fieldambiguousTriples.getAttribute(String key) getAttribute.getChildren(Node node) getChildren.intgetDegree.intgetDegree.getDirectedEdge(Node node1, Node node2) getDirectedEdge.getDottedUnderlines.getEdge.getEdges()getEdges.getEdges.getEdges.getEndpoint(Node node1, Node node2) getEndpoint.intgetIndegree(Node node) getIndegree.getNode.getNodeNames.getNodes()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.intgetNumEdges.intgetNumEdges(Node node) getNumEdges.intgetNumNodes.intgetOutdegree(Node node) getOutdegree.getParents(Node node) getParents.getSepset(Node n1, Node n2, IndependenceTest test) Returns the set of nodes that form the separating set between two given nodes.getTimeLagGraph.getUnderLines.booleanisAdjacentTo(Node node1, Node node2) isAdjacentTo.booleanisAmbiguousTriple(Node x, Node y, Node z) States whether r-s-r is an underline triple or not.booleanisAncestorOf(Node node1, Node node2) isAncestorOf.booleanisChildOf.booleanisDefCollider(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) isExogenous.booleanisParameterizable(Node node) isParameterizable.booleanisParentOf(Node node1, Node node2) Determines whether node1 is a parent of node2.booleanisTimeLagModel.booleanisUnderlineTriple(Node x, Node y, Node z) States whether r-s-r is an underline triple or not.paths()paths.voidremoveAmbiguousTriple(Node x, Node y, Node z) removeAmbiguousTriple.voidremoveAttribute(String key) removeAttribute.voidremoveDottedUnderlineTriple(Node x, Node y, Node z) removeDottedUnderlineTriple.booleanremoveEdge(Edge edge) Removes the given edge from the graph.booleanremoveEdge(Node node1, Node node2) Removes an edge between two given nodes.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.voidremoveTriplesNotInGraph.voidremoveUnderlineTriple(Node x, Node y, Node z) removeUnderlineTriple.voidreorientAllWith(Endpoint endpoint) Reorients all edges in the graph with the given endpoint.static LagGraphGenerates a simple exemplar of this class to test serialization.voidsetAmbiguousTriples(Set<Triple> triples) setAmbiguousTriples.voidsetDottedUnderLineTriples(Set<Triple> triples) setDottedUnderLineTriples.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.voidSetter for the fieldgraph.voidsetNodes.voidsetUnderLineTriples(Set<Triple> triples) setUnderLineTriples.Constructs and returns a subgraph consisting of a given subset of the nodes of this graph together with the edges between them.voidtransferAttributes(Graph graph) transferAttributes.voidtransferNodesAndEdges(Graph graph) Transfers nodes and edges from one graph to another.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.cmu.tetrad.graph.Graph
copy, equals, existsSemidirectedPath, toString
-
Constructor Details
-
LagGraph
public LagGraph()Constructor for LagGraph.
-
-
Method Details
-
serializableInstance
Generates a simple exemplar of this class to test serialization.- Returns:
- a
LagGraphobject
-
addVariable
addVariable.
- Parameters:
variable- aStringobject- Returns:
- a boolean
-
addDirectedEdge
Adds a directed edge --> to the graph.- Specified by:
addDirectedEdgein interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobject- Returns:
- a boolean
-
addNode
Adds a node to the graph. Precondition: The proposed name of the node cannot already be used by any other node in the same graph. -
addBidirectedEdge
Adds a bidirected edges <-> to the graph.- Specified by:
addBidirectedEdgein interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobject- Returns:
- a boolean
-
addUndirectedEdge
Adds an undirected edge --- to the graph.- Specified by:
addUndirectedEdgein interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobject- Returns:
- a boolean
-
addNondirectedEdge
Adds a nondirected edges o-o to the graph.- Specified by:
addNondirectedEdgein interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobject- Returns:
- a boolean
-
addPartiallyOrientedEdge
Adds a partially oriented edge o-> to the graph.- Specified by:
addPartiallyOrientedEdgein interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobject- Returns:
- a boolean
-
addEdge
Adds the specified edge to the graph, provided it is not already in the graph. -
addPropertyChangeListener
Adds a PropertyChangeListener to the graph.- Specified by:
addPropertyChangeListenerin interfaceGraph- Parameters:
e- aPropertyChangeListenerobject
-
clear
public void clear()clear.
-
containsEdge
Determines whether this graph contains the given edge.- Specified by:
containsEdgein interfaceGraph- Parameters:
edge- aEdgeobject- Returns:
- true iff the graph contain 'edge'.
-
containsNode
Determines whether this graph contains the given node.- Specified by:
containsNodein interfaceGraph- Parameters:
node- aNodeobject- Returns:
- true iff the graph contains 'node'.
-
fullyConnect
Removes all edges from the graph and fully connects it using #-# edges, where # is the given endpoint.- Specified by:
fullyConnectin interfaceGraph- Parameters:
endpoint- aEndpointobject
-
reorientAllWith
Reorients all edges in the graph with the given endpoint.- Specified by:
reorientAllWithin interfaceGraph- Parameters:
endpoint- aEndpointobject
-
getAdjacentNodes
getAdjacentNodes.
- Specified by:
getAdjacentNodesin interfaceGraph- Parameters:
node- aNodeobject- Returns:
- a mutable list of nodes adjacent to the given node.
-
getChildren
getChildren.
- Specified by:
getChildrenin interfaceGraph- Parameters:
node- aNodeobject- Returns:
- a mutable list of children for a node.
-
getDegree
public int getDegree()getDegree.
-
getEdge
getEdge.
-
getDirectedEdge
getDirectedEdge.
- Specified by:
getDirectedEdgein interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobject- Returns:
- the directed edge from node1 to node2, if there is one.
-
getEdges
getEdges.
-
getEdges
getEdges.
-
getEdges
getEdges.
-
getEndpoint
getEndpoint.
- Specified by:
getEndpointin interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobject- Returns:
- the endpoint along the edge from node to node2 at the node2 end.
-
getIndegree
getIndegree.
- Specified by:
getIndegreein interfaceGraph- Parameters:
node- aNodeobject- Returns:
- the number of arrow endpoints adjacent to a node.
-
getDegree
getDegree.
-
getNode
getNode.
-
getNodes
getNodes.
-
setNodes
setNodes.
-
getNodeNames
getNodeNames.
- Specified by:
getNodeNamesin interfaceGraph- Returns:
- a
Listobject
-
getNumEdges
public int getNumEdges()getNumEdges.
- Specified by:
getNumEdgesin interfaceGraph- Returns:
- a int
-
getNumEdges
getNumEdges.
- Specified by:
getNumEdgesin interfaceGraph- Parameters:
node- aNodeobject- Returns:
- the number of edges in the graph which are connected to a particular node.
-
getNumNodes
public int getNumNodes()getNumNodes.
- Specified by:
getNumNodesin interfaceGraph- Returns:
- a int
-
getOutdegree
getOutdegree.
- Specified by:
getOutdegreein interfaceGraph- Parameters:
node- aNodeobject- Returns:
- the number of null endpoints adjacent to an edge.
-
getParents
getParents.
- Specified by:
getParentsin interfaceGraph- Parameters:
node- aNodeobject- Returns:
- the list of parents for a node.
-
isAdjacentTo
isAdjacentTo.
- Specified by:
isAdjacentToin interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobject- Returns:
- true iff node1 is adjacent to node2 in the graph.
-
isAncestorOf
isAncestorOf.
- Specified by:
isAncestorOfin interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobject- Returns:
- a boolean
-
isChildOf
isChildOf.
-
isParentOf
Determines whether node1 is a parent of node2.- Specified by:
isParentOfin interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobject- Returns:
- a boolean
-
isDefNoncollider
Added by ekorber, 2004/6/9.- Specified by:
isDefNoncolliderin interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobjectnode3- aNodeobject- Returns:
- true if node 2 is a definite noncollider between 1 and 3
-
isDefCollider
Added by ekorber, 2004/6/9.- Specified by:
isDefColliderin interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobjectnode3- aNodeobject- Returns:
- true if node 2 is a definite collider between 1 and 3
-
isExogenous
isExogenous.
- Specified by:
isExogenousin interfaceGraph- Parameters:
node- aNodeobject- Returns:
- true iff the given node is exogenous in the graph.
-
getNodesInTo
Nodes adjacent to the given node with the given proximal endpoint.- Specified by:
getNodesInToin interfaceGraph- Parameters:
node- aNodeobjectn- aEndpointobject- Returns:
- a
Listobject
-
getNodesOutTo
Nodes adjacent to the given node with the given distal endpoint.- Specified by:
getNodesOutToin interfaceGraph- Parameters:
node- aNodeobjectn- aEndpointobject- Returns:
- a
Listobject
-
removeEdge
Removes the given edge from the graph.- Specified by:
removeEdgein interfaceGraph- Parameters:
edge- aEdgeobject- Returns:
- true if the edge was removed, false if not.
-
removeEdge
Removes an edge between two given nodes.- Specified by:
removeEdgein interfaceGraph- Parameters:
node1- The first node.node2- The second node.- Returns:
- true if the edge between node1 and node2 was successfully removed, false otherwise.
-
removeEdges
Removes 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 interfaceGraph- Parameters:
node1- aNodeobjectnode2- aNodeobject- Returns:
- true if edges were removed, false if not.
-
removeEdges
Iterates 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 interfaceGraph- Parameters:
edges- aCollectionobject- Returns:
- true if edges were added, false if not.
-
removeNode
Removes a node from the graph.- Specified by:
removeNodein interfaceGraph- Parameters:
node- aNodeobject- Returns:
- true if the node was removed, false if not.
-
removeNodes
Iterates 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 interfaceGraph- Parameters:
nodes- aListobject- Returns:
- true if nodes were added, false if not.
-
setEndpoint
Sets 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 interfaceGraph- Parameters:
from- aNodeobjectto- aNodeobjectendPoint- aEndpointobject- Returns:
- a boolean
-
subgraph
Constructs and returns a subgraph consisting of a given subset of the nodes of this graph together with the edges between them. -
transferNodesAndEdges
Transfers 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 interfaceGraph- Parameters:
graph- the graph from which nodes and edges are to be pilfered.- Throws:
IllegalArgumentException- This exception is thrown if adding some node.
-
transferAttributes
transferAttributes.
- Specified by:
transferAttributesin interfaceGraph- Parameters:
graph- aGraphobject- Throws:
IllegalArgumentException- if any.
-
paths
paths.
-
isParameterizable
isParameterizable.
- Specified by:
isParameterizablein interfaceGraph- Parameters:
node- aNodeobject- Returns:
- true if the given node is parameterizable.
-
isTimeLagModel
public boolean isTimeLagModel()isTimeLagModel.
- Specified by:
isTimeLagModelin interfaceGraph- Returns:
- a boolean
-
getTimeLagGraph
getTimeLagGraph.
- Specified by:
getTimeLagGraphin interfaceGraph- Returns:
- a
TimeLagGraphobject
-
getSepset
Returns the set of nodes that form the separating set between two given nodes. A separating set is a set of nodes that, when conditioned on, renders the given nodes d-separated. -
setGraph
Setter for the field
graph.- Parameters:
graph- aDagobject
-
getAllAttributes
getAllAttributes.
- Specified by:
getAllAttributesin interfaceGraph- Returns:
- a
Mapobject
-
getAttribute
getAttribute.
- Specified by:
getAttributein interfaceGraph- Parameters:
key- aStringobject- Returns:
- a
Objectobject
-
removeAttribute
removeAttribute.
- Specified by:
removeAttributein interfaceGraph- Parameters:
key- aStringobject
-
addAttribute
addAttribute.
- Specified by:
addAttributein interfaceGraph- Parameters:
key- aStringobjectvalue- aObjectobject
-
getAmbiguousTriples
Getter for the field
ambiguousTriples.- Specified by:
getAmbiguousTriplesin interfaceGraph- Returns:
- a
Setobject
-
setAmbiguousTriples
setAmbiguousTriples.
- Specified by:
setAmbiguousTriplesin interfaceGraph- Parameters:
triples- aSetobject
-
getUnderLines
getUnderLines.
- Specified by:
getUnderLinesin interfaceGraph- Returns:
- a
Setobject
-
getDottedUnderlines
getDottedUnderlines.
- Specified by:
getDottedUnderlinesin interfaceGraph- Returns:
- a
Setobject
-
isAmbiguousTriple
States whether r-s-r is an underline triple or not.States whether r-s-r is an underline triple or not.
- Specified by:
isAmbiguousTriplein interfaceGraph- Parameters:
x- aNodeobjecty- aNodeobjectz- aNodeobject- Returns:
- a boolean
-
isUnderlineTriple
States whether r-s-r is an underline triple or not.States whether r-s-r is an underline triple or not.
- Specified by:
isUnderlineTriplein interfaceGraph- Parameters:
x- aNodeobjecty- aNodeobjectz- aNodeobject- Returns:
- a boolean
-
addAmbiguousTriple
addAmbiguousTriple.
- Specified by:
addAmbiguousTriplein interfaceGraph- Parameters:
x- aNodeobjecty- aNodeobjectz- aNodeobject
-
addUnderlineTriple
addUnderlineTriple.
- Specified by:
addUnderlineTriplein interfaceGraph- Parameters:
x- aNodeobjecty- aNodeobjectz- aNodeobject
-
addDottedUnderlineTriple
addDottedUnderlineTriple.
- Specified by:
addDottedUnderlineTriplein interfaceGraph- Parameters:
x- aNodeobjecty- aNodeobjectz- aNodeobject
-
removeAmbiguousTriple
removeAmbiguousTriple.
- Specified by:
removeAmbiguousTriplein interfaceGraph- Parameters:
x- aNodeobjecty- aNodeobjectz- aNodeobject
-
removeUnderlineTriple
removeUnderlineTriple.
- Specified by:
removeUnderlineTriplein interfaceGraph- Parameters:
x- aNodeobjecty- aNodeobjectz- aNodeobject
-
removeDottedUnderlineTriple
removeDottedUnderlineTriple.
- Specified by:
removeDottedUnderlineTriplein interfaceGraph- Parameters:
x- aNodeobjecty- aNodeobjectz- aNodeobject
-
setUnderLineTriples
setUnderLineTriples.
- Specified by:
setUnderLineTriplesin interfaceGraph- Parameters:
triples- aSetobject
-
setDottedUnderLineTriples
setDottedUnderLineTriples.
- Specified by:
setDottedUnderLineTriplesin interfaceGraph- Parameters:
triples- aSetobject
-
removeTriplesNotInGraph
public void removeTriplesNotInGraph()removeTriplesNotInGraph.
- Specified by:
removeTriplesNotInGraphin interfaceGraph
-