Interface DirectedGraph

  • All Superinterfaces:
    Graph
    All Known Subinterfaces:
    DirectedSubgraph

    public interface DirectedGraph
    extends Graph
    Directed graph.

    This interface has additional methods specific to directed graphs compared to the Graph interface it inherits from.

    • Method Detail

      • getEdge

        Edge getEdge​(Node source,
                     Node target)
        Gets the edge adjacent to source and target.
        Specified by:
        getEdge in interface Graph
        Parameters:
        source - the source node
        target - the target node
        Returns:
        the adjacent edge, or null if not found
      • getEdge

        Edge getEdge​(Node source,
                     Node target,
                     int type)
        Gets the edge adjacent to source and target with an edge of the given type.
        Specified by:
        getEdge in interface Graph
        Parameters:
        source - the source node
        target - the target node
        type - the edge type
        Returns:
        the adjacent edge, or null if not found
      • isAdjacent

        boolean isAdjacent​(Node source,
                           Node target)
        Returns true if source and target are adjacent.
        Specified by:
        isAdjacent in interface Graph
        Parameters:
        source - the source node
        target - the target node
        Returns:
        true of adjacent, false otherwise
      • isAdjacent

        boolean isAdjacent​(Node source,
                           Node target,
                           int type)
        Returns true if source and target are adjacent with an edge of the given type.
        Specified by:
        isAdjacent in interface Graph
        Parameters:
        source - the source node
        target - the target node
        type - the edge type
        Returns:
        true if adjacent, false otherwise
      • getPredecessors

        NodeIterable getPredecessors​(Node node)
        Gets the node's predecessors.

        A node predecessor is a node connected by an incoming edge.

        Parameters:
        node - the node to get predecessors
        Returns:
        an iterable on node's predecessors
      • getPredecessors

        NodeIterable getPredecessors​(Node node,
                                     int type)
        Gets the node's predecessors through a specific edge type.

        A node predecessor is a node connected by an incoming edge.

        Parameters:
        node - the node to get predecessors
        type - the edge type
        Returns:
        an iterable on node's predecessors
      • getSuccessors

        NodeIterable getSuccessors​(Node node)
        Gets the node's successors.

        A node successor is a node connected by an outgoing edge.

        Parameters:
        node - the node to get successors
        Returns:
        an iterable on node's successors
      • getSuccessors

        NodeIterable getSuccessors​(Node node,
                                   int type)
        Gets the node's successors through a specific edge type.

        A node successor is a node connected by an outgoing edge.

        Parameters:
        node - the node to get successors
        type - the edge type
        Returns:
        an iterable on node's successors
      • getInEdges

        EdgeIterable getInEdges​(Node node)
        Gets the node's incoming edges.
        Parameters:
        node - the node to get incoming edges
        Returns:
        an iterable on node's incoming edges
      • getInEdges

        EdgeIterable getInEdges​(Node node,
                                int type)
        Gets the node's incoming edges for the given type.
        Parameters:
        node - the node to get incoming edges
        type - the edge type
        Returns:
        an iterable on node's incoming edges
      • getOutEdges

        EdgeIterable getOutEdges​(Node node)
        Gets the node's outgoing edges.
        Parameters:
        node - the node to get outgoing edges
        Returns:
        an iterable on node's outgoing edges
      • getOutEdges

        EdgeIterable getOutEdges​(Node node,
                                 int type)
        Gets the node's incoming edges for the given type.
        Parameters:
        node - the node to get incoming edges
        type - the edge type
        Returns:
        an iterable on node's incoming edges
      • getMutualEdge

        Edge getMutualEdge​(Edge edge)
        Gets the edge in the other direction of the given edge.

        This takes in account the edge type so only edges of the same type can be mutual.

        Parameters:
        edge - the edge to get the mutual edge
        Returns:
        the mutual edge, or null
      • getInDegree

        int getInDegree​(Node node)
        Gets the edge's in-degree.
        Parameters:
        node - the node to get the in-degree from
        Returns:
        the in-degree number
      • getOutDegree

        int getOutDegree​(Node node)
        Gets the edge's out-degree.
        Parameters:
        node - the node to get the out-degree from
        Returns:
        the out-degree number