Class Graph.Node

java.lang.Object
com.amalgamasimulation.graph.Graph.Node
Enclosing class:
Graph<N,A>

public class Graph.Node extends Object
Represents a node of the graph.
  • Field Details

  • Method Details

    • getValue

      public N getValue()
      Returns the value of the node.
      Returns:
      Value of the node
    • getArcsIn

      public List<Graph<N,A>.Arc> getArcsIn()
      Returns an unmodifiable list of arcs coming to the node. If no such arcs, an empty list is returned.
      Returns:
      List of arcs coming to the node
    • getFirstArcIn

      public Graph<N,A>.Arc getFirstArcIn()
      Returns first arc coming to the node. If no arcs come to the node, returns null. First arc returned by this method is always the same if graph is not changed.
      Returns:
      First arc coming to the node, or null
    • getArcsOut

      public List<Graph<N,A>.Arc> getArcsOut()
      Returns an unmodifiable list of arcs going out of the node. If no such arcs, an empty list is returned.
      Returns:
      List of arcs going out of the node
    • getFirstArcOut

      public Graph<N,A>.Arc getFirstArcOut()
      Returns first arc going out of the node. If no arcs go out of the node, returns null. First arc returned by this method is always the same if graph is not changed.
      Returns:
      First arc going out of the node, or null
    • getId

      public int getId()
      Returns unique identifier of the node within the graph. Identifier is 0-based sequence number with which the node was added to the graph
      Returns:
      Unique identifier of the node within the graph
    • toString

      public String toString()
      Overrides:
      toString in class Object