Class Graphs.UnmodifiableTree<V,E>

All Implemented Interfaces:
DirectedGraph<V,E>, Forest<V,E>, Graph<V,E>, Hypergraph<V,E>, Tree<V,E>, Serializable
Enclosing class:
Graphs

static class Graphs.UnmodifiableTree<V,E> extends Graphs.UnmodifiableForest<V,E> implements Tree<V,E>, Serializable
  • Constructor Details

    • UnmodifiableTree

      private UnmodifiableTree(Tree<V,E> delegate)
  • Method Details

    • getDepth

      public int getDepth(V vertex)
      Description copied from interface: Tree
      Returns the (unweighted) distance of vertex from the root of this tree.
      Specified by:
      getDepth in interface Tree<V,E>
      Parameters:
      vertex - the vertex whose depth is to be returned.
      Returns:
      the length of the shortest unweighted path from vertex to the root of this tree
      See Also:
    • getHeight

      public int getHeight()
      Description copied from interface: Tree
      Returns the maximum depth in this tree.
      Specified by:
      getHeight in interface Tree<V,E>
      Returns:
      the maximum depth in this tree
      See Also:
    • getRoot

      public V getRoot()
      Description copied from interface: Tree
      Returns the root of this tree. The root is defined to be the vertex (designated either at the tree's creation time, or as the first vertex to be added) with respect to which vertex depth is measured.
      Specified by:
      getRoot in interface Tree<V,E>
      Returns:
      the root of this tree
    • getTrees

      public Collection<Tree<V,E>> getTrees()
      Description copied from interface: Forest
      Returns a view of this graph as a collection of Tree instances.
      Specified by:
      getTrees in interface Forest<V,E>
      Overrides:
      getTrees in class Graphs.UnmodifiableForest<V,E>
      Returns:
      a view of this graph as a collection of Trees