public class Node extends GraphComponent
PlanarGraph
is a location where 0 or more Edge
s
meet. A node is connected to each of its incident Edges via an outgoing
DirectedEdge. Some clients using a PlanarGraph
may want to
subclass Node
to add their own application-specific
data and methods.Constructor and Description |
---|
Node(Coordinate pt)
Constructs a Node with the given location.
|
Node(Coordinate pt,
DirectedEdgeStar deStar)
Constructs a Node with the given location and collection of outgoing DirectedEdges.
|
Modifier and Type | Method and Description |
---|---|
void |
addOutEdge(DirectedEdge de)
Adds an outgoing DirectedEdge to this Node.
|
Coordinate |
getCoordinate()
Returns the location of this Node.
|
int |
getDegree()
Returns the number of edges around this Node.
|
static Collection |
getEdgesBetween(Node node0,
Node node1)
Returns all Edges that connect the two nodes (which are assumed to be different).
|
int |
getIndex(Edge edge)
Returns the zero-based index of the given Edge, after sorting in ascending order
by angle with the positive x-axis.
|
DirectedEdgeStar |
getOutEdges()
Returns the collection of DirectedEdges that leave this Node.
|
boolean |
isRemoved()
Tests whether this node has been removed from its containing graph
|
void |
remove(DirectedEdge de)
Removes a
DirectedEdge incident on this node. |
getComponentWithVisitedState, getContext, getData, isMarked, isVisited, setContext, setData, setMarked, setMarked, setVisited, setVisited
public Node(Coordinate pt)
public Node(Coordinate pt, DirectedEdgeStar deStar)
public static Collection getEdgesBetween(Node node0, Node node1)
public Coordinate getCoordinate()
public void addOutEdge(DirectedEdge de)
public DirectedEdgeStar getOutEdges()
public int getDegree()
public int getIndex(Edge edge)
public void remove(DirectedEdge de)
DirectedEdge
incident on this node.
Does not change the state of the directed edge.public boolean isRemoved()
isRemoved
in class GraphComponent
true
if this node is removedCopyright © 2022. All rights reserved.