Package edu.cmu.tetrad.graph
Class Edges
java.lang.Object
edu.cmu.tetrad.graph.Edges
This factory class produces edges of the types commonly used for Tetrad-style graphs. For each method in the class,
one supplies a pair of nodes, and an edge is returned, connecting those nodes, of the specified type. Methods are
also included to help determine whether a specified edge falls into one of the types produced by this factory. It's
entirely possible to produce edges of these types other than by using this factory. For randomUtil, an edge counts
as a directed edge just in case it has one null endpoint and one arrow endpoint. Any edge which has one null
endpoint and one arrow endpoint will do, whether or not this factory produced it. These helper methods provide a
uniform way of testing whether an edge is in fact, e.g., a directed edge (or any of the other types).
- Author:
- josephramsey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EdgebidirectedEdge(Node nodeA, Node nodeB) Constructs a new bidirected edge from nodeA to nodeB (<->).static EdgedirectedEdge(Node nodeA, Node nodeB) Constructs a new directed edge from nodeA to nodeB (-->).static NodegetDirectedEdgeHead(Edge edge) For a directed edge, returns the node adjacent to the arrow endpoint.static NodegetDirectedEdgeTail(Edge edge) For a directed edge, returns the node adjacent to the null endpoint.static booleanisBidirectedEdge(Edge edge) static booleanisDirectedEdge(Edge edge) static booleanisNondirectedEdge(Edge edge) static booleanisPartiallyOrientedEdge(Edge edge) static booleanisUndirectedEdge(Edge edge) static EdgenondirectedEdge(Node nodeA, Node nodeB) Constructs a new nondirected edge from nodeA to nodeB (o-o).static EdgepartiallyOrientedEdge(Node nodeA, Node nodeB) Constructs a new partially oriented edge from nodeA to nodeB (o->).static voidstatic Nodestatic NodetraverseDirected(Node node, Edge edge) For A -> B, given A, returns B; otherwise returns null.static NodetraverseReverseDirected(Node node, Edge edge) For A -> B, given B, returns A; otherwise returns null.static NodetraverseSemiDirected(Node node, Edge edge) For A --* B or A o-* B, given A, returns B.static EdgeundirectedEdge(Node nodeA, Node nodeB) Constructs a new undirected edge from nodeA to nodeB (--).
-
Constructor Details
-
Edges
public Edges()
-
-
Method Details
-
bidirectedEdge
Constructs a new bidirected edge from nodeA to nodeB (<->). -
directedEdge
Constructs a new directed edge from nodeA to nodeB (-->). -
partiallyOrientedEdge
Constructs a new partially oriented edge from nodeA to nodeB (o->). -
nondirectedEdge
Constructs a new nondirected edge from nodeA to nodeB (o-o). -
undirectedEdge
Constructs a new undirected edge from nodeA to nodeB (--). -
isBidirectedEdge
- Returns:
- true iff an edge is a bidirected edge (<->).
-
isDirectedEdge
- Returns:
- true iff the given edge is a directed edge (-->).
-
isPartiallyOrientedEdge
- Returns:
- true iff the given edge is a partially oriented edge (o->)
-
isNondirectedEdge
- Returns:
- true iff some edge is an nondirected edge (o-o).
-
isUndirectedEdge
- Returns:
- true iff some edge is an undirected edge (-).
-
traverse
- Returns:
- the node opposite the given node along the given edge.
-
traverseDirected
For A -> B, given A, returns B; otherwise returns null. -
traverseReverseDirected
For A -> B, given B, returns A; otherwise returns null. -
traverseSemiDirected
For A --* B or A o-* B, given A, returns B. For A <-* B, returns null. Added by ekorber, 2004/06/12. -
getDirectedEdgeHead
For a directed edge, returns the node adjacent to the arrow endpoint.- Throws:
IllegalArgumentException- if the given edge is not a directed edge.
-
getDirectedEdgeTail
For a directed edge, returns the node adjacent to the null endpoint.- Throws:
IllegalArgumentException- if the given edge is not a directed edge.
-
sortEdges
-