Module graph

Interface Path

All Known Implementing Classes:
ArrayPath

public interface Path
A Path consists of an alternating sequence of nodes and edges (starting with a node) of a graph. An edge of a graph is incident with its neighbouring nodes in the path.

The nodes and edges of this path are accessed using their index. Because a path starts with a node, nodes have even indices, while edges haves odd indices. If the index parameter to one of the methods of Path is negative, it is interpreted as an index relative to the end of the path, i.e., the actual index is path.getNodeAndEdgeCount () + index.

Author:
Ole Kniemeyer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Path[]
    A constant array of length 0.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getEdgeBits(int index)
    Returns the edge bits (see Graph.getEdgeBits(Object)) of the edge at index.
    Returns the graph which contains this path.
    int
    Returns the number of nodes and edges of this path.
    getObject(int index)
    Returns the node or edge at index.
    long
    getObjectId(int index)
     
    boolean
    isInEdgeDirection(int index)
    Checks whether the path traverses the edge at index in edge direction or in reverse edge direction.
    boolean
    isInstancingEdge(int index)
     
  • Field Details

    • PATH_0

      static final Path[] PATH_0
      A constant array of length 0.
  • Method Details

    • getGraph

      Graph getGraph()
      Returns the graph which contains this path.
      Returns:
      graph of path
    • getNodeAndEdgeCount

      int getNodeAndEdgeCount()
      Returns the number of nodes and edges of this path. If this is even, the path ends in an edge; if this is odd, the path ends in a node.
      Returns:
      number of nodes and edges
    • getEdgeBits

      int getEdgeBits(int index)
      Returns the edge bits (see Graph.getEdgeBits(Object)) of the edge at index. If index is negative, it is relative to the end of the list, i.e., it is incremented by getNodeAndEdgeCount(). The actual index has to be odd because edges have odd indices.
      Parameters:
      index - edge index
      Returns:
      edge bits of edge
    • isInEdgeDirection

      boolean isInEdgeDirection(int index)
      Checks whether the path traverses the edge at index in edge direction or in reverse edge direction. If index is negative, it is relative to the end of the list, i.e., it is incremented by getNodeAndEdgeCount(). The actual index has to be odd because edges have odd indices.
      Parameters:
      index - edge index
      Returns:
      true iff path traverses edge in its direction
    • getObject

      Object getObject(int index)
      Returns the node or edge at index. Because a path always starts with a node, even values of index address nodes, while odd values address edges. Edges may be returned as null, in this case only the information provided by getEdgeBits(int) and isInEdgeDirection(int) is available for the edge. If index is negative, it is relative to the end of the list, i.e., it is incremented by getNodeAndEdgeCount().
      Parameters:
      index - node or edge index
      Returns:
      node or edge at index
    • getObjectId

      long getObjectId(int index)
    • isInstancingEdge

      boolean isInstancingEdge(int index)