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:
- Joseph Ramsey
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddProperty(Edge.Property property) intfinal booleanTwo edges are equal just in case they connect the same nodes and have the same endpoints proximal to each node.final EndpointgetDistalEndpoint(Node node) final NodegetDistalNode(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 Endpointfinal Endpointfinal NodegetNode1()final NodegetNode2()doublefinal EndpointgetProximalEndpoint(Node node) final inthashCode()booleanbooleanbooleanisNull()booleanpointsTowards(Node node) reverse()static EdgeGenerates a simple exemplar of this class to test serialization.final voidfinal voidvoidsetHighlighted(boolean highlighted) voidsetProbability(double probability) final StringtoString()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.
-
getEndpoint2
- Returns:
- the endpoint of the edge at the B node.
-
setEndpoint1
-
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:
compareToin 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)
-