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.
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEdgeTypeProbability.void
addProperty
(Edge.Property property) addProperty.int
compareTo.final boolean
final Endpoint
getDistalEndpoint
(Node node) getDistalEndpoint.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.Getter for the fieldedgeTypeProbabilities
.final Endpoint
Getter for the fieldendpoint1
.final Endpoint
Getter for the fieldendpoint2
.Getter for the fieldlineColor
.final Node
getNode1()
Getter for the fieldnode1
.final Node
getNode2()
Getter for the fieldnode2
.double
Getter for the fieldprobability
.Getter for the fieldproperties
.final Endpoint
getProximalEndpoint
(Node node) getProximalEndpoint.final int
hashCode()
hashCode.boolean
isDirected.boolean
isHighlighted.boolean
isNull()
isNull.boolean
pointsTowards
(Node node) pointsTowards.reverse()
reverse.static Edge
Generates a simple exemplar of this class to test serialization.final void
Setter for the fieldendpoint1
.final void
Setter for the fieldendpoint2
.void
setHighlighted
(boolean highlighted) Setter for the fieldhighlighted
.void
setProbability
(double probability) Setter for the fieldprobability
.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
-
getNode1
-
getNode2
-
getEndpoint1
Getter for the field
endpoint1
.- Returns:
- the endpoint of the edge at the A node.
-
setEndpoint1
-
getEndpoint2
Getter for the field
endpoint2
.- Returns:
- the endpoint of the edge at the B node.
-
setEndpoint2
-
getProximalEndpoint
getProximalEndpoint.
- Parameters:
node
- aNode
object- Returns:
- the endpoint nearest to the given node.
- Throws:
IllegalArgumentException
- if the given node is not along the edge.
-
getDistalEndpoint
getDistalEndpoint.
- Parameters:
node
- aNode
object- Returns:
- the endpoint furthest from the given node.
- Throws:
IllegalArgumentException
- if the given node is not along the edge.
-
getDistalNode
-
isDirected
public boolean isDirected()isDirected.
- Returns:
- true just in case this edge is directed.
-
pointsTowards
-
reverse
-
toString
-
hashCode
-
equals
-
compareTo
compareTo.
- Specified by:
compareTo
in interfaceComparable<Edge>
- Parameters:
_edge
- aEdge
object- Returns:
- a int
-
isNull
public boolean isNull()isNull.
- Returns:
- a boolean
-
getLineColor
-
addProperty
addProperty.
- Parameters:
property
- aEdge.Property
object
-
getProperties
Getter for the field
properties
.- Returns:
- a
ArrayList
object
-
addEdgeTypeProbability
addEdgeTypeProbability.
- Parameters:
prob
- aEdgeTypeProbability
object
-
getEdgeTypeProbabilities
Getter for the field
edgeTypeProbabilities
.- Returns:
- a
List
object
-
getProbability
public double getProbability()Getter for the field
probability
.- Returns:
- a double
-
setProbability
public void setProbability(double probability) Setter for the field
probability
.- Parameters:
probability
- a double
-
isHighlighted
public boolean isHighlighted()isHighlighted.
- Returns:
- a boolean
-
setHighlighted
public void setHighlighted(boolean highlighted) Setter for the field
highlighted
.- Parameters:
highlighted
- a boolean
-