Class AdjacencyListNode

All Implemented Interfaces:
Iterable<Edge>, Element, Node
Direct Known Subclasses:
MultiNode, SingleNode

public class AdjacencyListNode
extends AbstractNode
Nodes used with AdjacencyListGraph
  • Method Details

    • getDegree

      public int getDegree()
      Description copied from interface: Node
      Total number of relations with other nodes or this node.
      Returns:
      The number of edges/relations/links.
    • getInDegree

      public int getInDegree()
      Description copied from interface: Node
      Number of entering edges.
      Returns:
      the count of edges that only enter this node plus all undirected edges.
    • getOutDegree

      public int getOutDegree()
      Description copied from interface: Node
      Number of leaving edges.
      Returns:
      the count of edges that only leave this node plus all undirected edges.
    • getEdge

      public Edge getEdge​(int i)
      Description copied from interface: Node
      I-th edge. Edges are stored in no given order.

      However this method allows to iterate very quickly on all edges, or to choose a given edge with direct access.

      This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :

       ExtendedEdge e = node.getEdge(i);
       
      the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.

      Parameters:
      i - Index of the edge.
      Returns:
      The i-th edge.
    • getEnteringEdge

      public Edge getEnteringEdge​(int i)
      Description copied from interface: Node
      I-th entering edge. Edges are stored in no given order.

      However this method allows to iterate very quickly on all entering edges, or to choose a given entering edge with direct access.

      This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :

       ExtendedEdge e = node.getEnteringEdge(i);
       
      the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.

      Parameters:
      i - Index of the edge.
      Returns:
      The i-th entering edge.
    • getLeavingEdge

      public Edge getLeavingEdge​(int i)
      Description copied from interface: Node
      I-th leaving edge. Edges are stored in no given order.

      However this method allows to iterate very quickly on all leaving edges, or to choose a given leaving edge with direct access.

      This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :

       ExtendedEdge e = node.getLeavingEdge(i);
       
      the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.

      Parameters:
      i - Index of the edge.
      Returns:
      The i-th leaving edge.
    • getEdgeBetween

      public Edge getEdgeBetween​(Node node)
      Description copied from interface: Node
      Retrieves an edge between this node and and another node if one exists.

      This method selects directed or undirected edges. If the edge is directed, its direction is not important and leaving or entering edges will be selected.

      This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :

       ExtendedEdge e = node.getEdgeBetween(...);
       
      the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.

      Parameters:
      node - The opposite node.
      Returns:
      Edge between this node and the parameter node if it exists, else null.
    • getEdgeFrom

      public Edge getEdgeFrom​(Node node)
      Description copied from interface: Node
      Retrieves an edge that leaves given node toward this node.

      This method selects only edges leaving the other node an pointing at this node (this also selects undirected edges).

      This method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :

       ExtendedEdge e = node.getEdgeFrom(...);
       
      the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.

      Parameters:
      node - The source node.
      Returns:
      Directed edge going from the parameter node to this node, or undirected edge if it exists, else null.
    • getEdgeToward

      public Edge getEdgeToward​(Node node)
      Description copied from interface: Node
      Retrieves an edge that leaves this node toward another node.

      This method selects only edges leaving this node an pointing at the parameter node (this also selects undirected edges).

      This method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :

       ExtendedEdge e = node.getEdgeToward(...);
       
      the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.

      Parameters:
      node - The target node.
      Returns:
      Directed edge going from this node to the parameter node, or undirected edge if it exists, else null.
    • edges

      public Stream<Edge> edges()
      Description copied from interface: Node
      Stream over all entering and leaving edges.
      Returns:
      A stream over all directed and undirected edges, leaving or entering.
    • enteringEdges

      public Stream<Edge> enteringEdges()
      Description copied from interface: Node
      Stream over all entering edges.
      Returns:
      A stream over only edges that enter this node plus all undirected edges.
    • leavingEdges

      public Stream<Edge> leavingEdges()
      Description copied from interface: Node
      Stream over all leaving edges.
      Returns:
      A stream over only edges that leave this node plus all undirected edges.