Package dev.nm.graph

Interface RootedTree<V,​E extends Arc<V>>

    • Method Detail

      • root

        V root()
        Gets the root of this tree. The root is defined to be the vertex with respect to which vertex depth is measured.
        Returns:
        the root of this tree
      • depth

        int depth​(V v)
        Gets the (unweighted) distance of a vertex from the root of the vertex.
        Parameters:
        v - the vertex whose depth is to be computed
        Returns:
        the length of the shortest unweighted path from its root to the vertex
      • height

        int height()
        Gets the maximum depth in this tree.
        Returns:
        the maximum depth in this tree
      • subTree

        RootedTree<V,​E> subTree​(V v)
        Gets a sub-tree starting from a vertex.
        Parameters:
        v - the root of the sub-tree
        Returns:
        the sub-tree