Interface DirectedGraph<V>

Type Parameters:
V - Type of vertices.
All Superinterfaces:
Graph<V>, java.io.Serializable
All Known Subinterfaces:
DirectedMultiGraph<U>, DirectedUnweightedGraph<V>, DirectedUnweightedMultiGraph<V>, DirectedWeightedGraph<V>, DirectedWeightedMultiGraph<U>, Tree<U>, UnweightedTree<U>, WeightedTree<U>
All Known Implementing Classes:
DirectedJungGraph, DirectedUnweightedComplementaryGraph, DirectedWeightedComplementaryGraph, FastDirectedUnweightedGraph, FastDirectedUnweightedMultiGraph, FastDirectedWeightedGraph, FastDirectedWeightedMultiGraph, FastTree, FastUnweightedTree, FastWeightedTree

public interface DirectedGraph<V>
extends Graph<V>
Interface for directed graphs.
  • Method Details

    • getNeighbourhood

      default java.util.stream.Stream<V> getNeighbourhood​(V node, EdgeOrientation direction)
      Description copied from interface: Graph
      Gets all the nodes in the neighbourhood of a node given by a direction.
      Specified by:
      getNeighbourhood in interface Graph<V>
      Parameters:
      node - The node.
      direction - The direction of the links.
      Returns:
      A stream containing the corresponding neighbourhood.
    • getNeighbourhoodSize

      default int getNeighbourhoodSize​(V node, EdgeOrientation direction)
      Description copied from interface: Graph
      Gets all the nodes in the neighbourhood of a node given by a direction.
      Specified by:
      getNeighbourhoodSize in interface Graph<V>
      Parameters:
      node - The node.
      direction - The direction of the links.
      Returns:
      A stream containing the corresponding neighbourhood.
    • getNeighbourhoodWeights

      default java.util.stream.Stream<Weight<V,​java.lang.Double>> getNeighbourhoodWeights​(V node, EdgeOrientation direction)
      Description copied from interface: Graph
      Gets all the weights of the edges in the neighbourhood of a node given by a direction. In the mutual case, just returns the average of the edge weights.
      Specified by:
      getNeighbourhoodWeights in interface Graph<V>
      Parameters:
      node - The node.
      direction - The direction of the links
      Returns:
      A stream containing the corresponding neighbourhood and weights.
    • getNeighbourhoodTypes

      default java.util.stream.Stream<Weight<V,​java.lang.Integer>> getNeighbourhoodTypes​(V node, EdgeOrientation direction)
      Description copied from interface: Graph
      Gets all the types of the edges in the neighbourhood of a node given by a direction. In the mutual case, it does not work (types are categorical values), so an empty stream is returned.
      Specified by:
      getNeighbourhoodTypes in interface Graph<V>
      Parameters:
      node - The node.
      direction - The direction of the links.
      Returns:
      A stream containing the corresponding neighbourhood.
    • degree

      default int degree​(V node)
      Description copied from interface: Graph
      Calculates the degree of a node.
      Specified by:
      degree in interface Graph<V>
      Parameters:
      node - The node.
      Returns:
      the degree of the node if it is contained in the graph, -1 otherwise.
    • inDegree

      default int inDegree​(V node)
      Obtains the in-degree of a node.
      Specified by:
      inDegree in interface Graph<V>
      Parameters:
      node - The node.
      Returns:
      the in-degree of the node.
    • outDegree

      default int outDegree​(V node)
      Obtains the out-degree of a node.
      Specified by:
      outDegree in interface Graph<V>
      Parameters:
      node - The node.
      Returns:
      the out-degree of the node.
    • mutualDegree

      default int mutualDegree​(V node)
      Obtains the mutual degree of a node.
      Specified by:
      mutualDegree in interface Graph<V>
      Parameters:
      node - the node.
      Returns:
      the mutual degree of the node
    • degree

      default int degree​(V node, EdgeOrientation orientation)
      Description copied from interface: Graph
      Obtains the degree of a node, depending on the neighborhood selection.
      Specified by:
      degree in interface Graph<V>
      Parameters:
      node - The node whose degree we want to find.
      orientation - The neighborhood selection.
      Returns:
      the degree.
    • getNeighbourEdgesCount

      default int getNeighbourEdgesCount​(V node)
      Description copied from interface: Graph
      Calculates the total number of edges which reach a node or start from it (not necessarily equal to the degree).
      Specified by:
      getNeighbourEdgesCount in interface Graph<V>
      Parameters:
      node - The node.
      Returns:
      the degree of the node if it is contained in the graph, -1 if not.
    • isDirected

      default boolean isDirected()
      Description copied from interface: Graph
      Indicates if the graph is directed.
      Specified by:
      isDirected in interface Graph<V>
      Returns:
      true if it is, false if not.
    • getSources

      default java.util.stream.Stream<V> getSources()
      Gets all the nodes which just have outgoing links.
      Returns:
      the set of nodes with just outgoing links.
    • getSinks

      default java.util.stream.Stream<V> getSinks()
      Gets all the nodes which just have incoming links.
      Returns:
      the set of nodes with just incoming links.