Package edu.cmu.tetrad.graph
Class Edge
java.lang.Object
edu.cmu.tetrad.graph.Edge
- All Implemented Interfaces:
TetradSerializable
,Serializable
,Comparable<Edge>
Represents an edge node1 *-# node2 where * and # are endpoints of type Endpoint--that is, Endpoint.TAIL,
Endpoint.ARROW, or Endpoint.CIRCLE.
Note that because speed is of the essence, and Edge cannot be compared to an object of any other type; this will throw an exception.
- Author:
- josephramsey
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addProperty
(Edge.Property property) int
final boolean
Two edges are equal just in case they connect the same nodes and have the same endpoints proximal to each node.final Endpoint
getDistalEndpoint
(Node node) final Node
getDistalNode
(Node node) Traverses the edge in an undirected fashion--given one node along the edge, returns the node at the opposite end of the edge.final Endpoint
final Endpoint
final Node
getNode1()
final Node
getNode2()
double
final Endpoint
getProximalEndpoint
(Node node) final int
hashCode()
boolean
boolean
boolean
isNull()
boolean
pointsTowards
(Node node) reverse()
static Edge
Generates a simple exemplar of this class to test serialization.final void
final void
void
setHighlighted
(boolean highlighted) void
setProbability
(double probability) final String
toString()
Produces a string representation of the edge.
-
Constructor Details
-
Edge
Constructs a new edge by specifying the nodes it connects and the endpoint types.- Parameters:
node1
- the first nodenode2
- the second node _endpoint1
- the endpoint at the first nodeendpoint2
- the endpoint at the second node
-
Edge
-
-
Method Details
-
serializableInstance
Generates a simple exemplar of this class to test serialization. -
getNode1
- Returns:
- the A node.
-
getNode2
- Returns:
- the B node.
-
getEndpoint1
- Returns:
- the endpoint of the edge at the A node.
-
setEndpoint1
-
getEndpoint2
- Returns:
- the endpoint of the edge at the B node.
-
setEndpoint2
-
getProximalEndpoint
- Returns:
- the endpoint nearest to the given node.
- Throws:
IllegalArgumentException
- if the given node is not along the edge.
-
getDistalEndpoint
- Returns:
- the endpoint furthest from the given node.
- Throws:
IllegalArgumentException
- if the given node is not along the edge.
-
getDistalNode
Traverses the edge in an undirected fashion--given one node along the edge, returns the node at the opposite end of the edge. -
isDirected
public boolean isDirected()- Returns:
- true just in case this edge is directed.
-
pointsTowards
- Returns:
- true just in case the edge is pointing toward the given node-- that is, x --> node or x o--> node.
-
reverse
- Returns:
- the edge with endpoints reversed.
-
toString
Produces a string representation of the edge. -
hashCode
public final int hashCode() -
equals
Two edges are equal just in case they connect the same nodes and have the same endpoints proximal to each node. -
compareTo
- Specified by:
compareTo
in interfaceComparable<Edge>
-
isNull
public boolean isNull() -
getLineColor
-
addProperty
-
getProperties
-
addEdgeTypeProbability
-
getEdgeTypeProbabilities
-
getProbability
public double getProbability() -
setProbability
public void setProbability(double probability) -
isHighlighted
public boolean isHighlighted() -
setHighlighted
public void setHighlighted(boolean highlighted)
-