public class Edge extends GraphComponent
PlanarGraph. An undirected edge in fact simply acts as a central point of reference for two opposite
DirectedEdges.
Usually a client using a PlanarGraph will subclass Edge to add its own application-specific data and methods.
| Modifier and Type | Field and Description |
|---|---|
protected DirectedEdge |
dirEdge
The two DirectedEdges associated with this Edge.
|
isMarked, isVisited| Constructor and Description |
|---|
Edge()
Constructs an Edge whose DirectedEdges are not yet set.
|
Edge(DirectedEdge
Constructs an Edge initialized with the given DirectedEdges, and for each DirectedEdge: sets the Edge, sets the symmetric DirectedEdge, and adds this Edge to its from-Node.
|
| Modifier and Type | Method and Description |
|---|---|
DirectedEdge |
getDirEdge(int i)
Returns one of the DirectedEdges associated with this Edge.
|
DirectedEdge |
getDirEdge(Node
Returns the
DirectedEdge that starts from the given node, or null if the node is not one of the two nodes associated with this Edge.
|
Node |
getOppositeNode(Node
If
node is one of the two nodes associated with this Edge, returns the other node; otherwise returns null.
|
boolean |
isRemoved()
Tests whether this edge has been removed from its containing graph
|
void |
setDirectedEdges(DirectedEdge
Initializes this Edge's two DirectedEdges, and for each DirectedEdge: sets the Edge, sets the symmetric DirectedEdge, and adds this Edge to its from-Node.
|
getComponentWithVisitedState, getContext, getData, isMarked, isVisited, setContext, setData, setMarked, setMarked, setVisited, setVisitedprotected DirectedEdge[] dirEdge
public Edge()
setDirectedEdges(DirectedEdge, DirectedEdge)
public Edge(DirectedEdgede0, DirectedEdge de1)
public void setDirectedEdges(DirectedEdgede0, DirectedEdge de1)
public DirectedEdgegetDirEdge(int i)
i - 0 or 1. 0 returns the forward directed edge, 1 returns the reverse
public DirectedEdgegetDirEdge(Node fromNode)
DirectedEdge that starts from the given node, or null if the node is not one of the two nodes associated with this Edge.
public NodegetOppositeNode(Node node)
node is one of the two nodes associated with this Edge, returns the other node; otherwise returns null.
public boolean isRemoved()
isRemoved in class
GraphComponent
true if this edge is removed