@Override public synchronized V getRoot() { return ((Tree<V, E>) delegate).getRoot(); } }
@Override public int getDepth(V vertex) { return ((Tree<V, E>) delegate).getDepth(vertex); }
@Override public int getHeight() { return ((Tree<V, E>) delegate).getHeight(); }
@Override public Collection<Tree<V, E>> getTrees() { return ((Tree<V, E>) delegate).getTrees(); } }
@Override public Collection<Tree<V, E>> getTrees() { Collection<Tree<V, E>> trees = new HashSet<Tree<V, E>>(); for (V v : getRoots()) { Tree<V, E> tree = new DelegateTree<V, E>(); tree.addVertex(v); TreeUtils.growSubTree(this, tree, v); trees.add(tree); } return trees; }
@Override public Collection<Tree<V, E>> getTrees() { return ((Tree<V,E>)delegate).getTrees(); } }
public Collection<Tree<V, E>> getTrees() { Collection<Tree<V,E>> trees = new HashSet<Tree<V,E>>(); for(V v : getRoots()) { Tree<V,E> tree = new DelegateTree<V,E>(); tree.addVertex(v); TreeUtils.growSubTree(this, tree, v); trees.add(tree); } return trees; }
@Override public V getRoot() { return ((Tree<V, E>) delegate).getRoot(); }
@Override public synchronized int getDepth(V vertex) { return ((Tree<V, E>) delegate).getDepth(vertex); }
@Override public synchronized int getHeight() { return ((Tree<V, E>) delegate).getHeight(); }
public synchronized V getRoot() { return ((Tree<V,E>)delegate).getRoot(); } }
public int getDepth(V vertex) { return ((Tree<V,E>)delegate).getDepth(vertex); }
public synchronized int getHeight() { return ((Tree<V,E>)delegate).getHeight(); }
public V getRoot() { return ((Tree<V,E>)delegate).getRoot(); }
public synchronized int getDepth(V vertex) { return ((Tree<V,E>)delegate).getDepth(vertex); }
public int getHeight() { return ((Tree<V,E>)delegate).getHeight(); }
/** * @param <V> the vertex type * @param <E> the edge type * @param forest the forest whose roots are to be returned * @return the roots of this forest. */ public static <V,E> List<V> getRoots(Forest<V,E> forest) { List<V> roots = new ArrayList<V>(); for(Tree<V,E> tree : forest.getTrees()) { roots.add(tree.getRoot()); } return roots; }
/** * Returns a list of all the roots - the entry which is at the start of each chain or branch. For the tree to be a * tree, there should only be one of these * * @return */ public List<V> getRoots() { Collection<Tree<V, Integer>> t = graph.getTrees(); List<V> branchRoots = new ArrayList<V>(); for (Tree<V, Integer> branch : t) { branchRoots.add(branch.getRoot()); } return branchRoots; }
/** * Returns a list of all the roots - the entry which is at the start of each chain or branch. For the tree to be a * tree, there should only be one of these * * @return */ public List<V> getRoots() { Collection<Tree<V, Integer>> t = graph.getTrees(); List<V> branchRoots = new ArrayList<V>(); for (Tree<V, Integer> branch : t) { branchRoots.add(branch.getRoot()); } return branchRoots; }