Class Node


public class Node extends GraphComponent
A node in a PlanarGraphis a location where 0 or more Edges 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.
Version:
1.7
  • Field Details

    • pt

      protected Coordinate pt
      The location of this Node
    • deStar

      protected DirectedEdgeStar deStar
      The collection of DirectedEdges that leave this Node
  • Constructor Details

    • Node

      public Node(Coordinate pt)
      Constructs a Node with the given location.
    • Node

      public Node(Coordinate pt, DirectedEdgeStar deStar)
      Constructs a Node with the given location and collection of outgoing DirectedEdges.
  • Method Details

    • getEdgesBetween

      public static Collection getEdgesBetween(Node node0, Node node1)
      Returns all Edges that connect the two nodes (which are assumed to be different).
    • getCoordinate

      public Coordinate getCoordinate()
      Returns the location of this Node.
    • addOutEdge

      public void addOutEdge(DirectedEdge de)
      Adds an outgoing DirectedEdge to this Node.
    • getOutEdges

      public DirectedEdgeStar getOutEdges()
      Returns the collection of DirectedEdges that leave this Node.
    • getDegree

      public int getDegree()
      Returns the number of edges around this Node.
    • getIndex

      public 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.
    • remove

      public void remove(DirectedEdge de)
      Removes a DirectedEdge incident on this node. Does not change the state of the directed edge.
    • remove

      void remove()
      Removes this node from its containing graph.
    • isRemoved

      public boolean isRemoved()
      Tests whether this node has been removed from its containing graph
      Specified by:
      isRemoved in class GraphComponent
      Returns:
      true if this node is removed