test_class.file: jung-api/src/test/java/edu/uci/ics/jung/graph/util/TreeUtilsTest.java
test_class.identifier: TreeUtilsTest
test_case.body: @Test
    public void testSubTree() {
  
      MutableCTreeNetwork<String, Integer> tree =
          TreeNetworkBuilder.builder().expectedNodeCount(7).build();
  
      tree.addNode("root");
  
      tree.addEdge("root", "child1", 1); // two kids
      tree.addEdge("root", "child2", 2);
  
      tree.addEdge("child1", "grandchild11", 11);
      tree.addEdge("child1", "grandchild12", 12);
  
      tree.addEdge("child2", "grandchild21", 21);
      tree.addEdge("child2", "grandchild22", 22);
  
      MutableCTreeNetwork<String, Integer> subTree = TreeUtils.getSubTree(tree, "root");
  
      // better be the same
      assertEquals(tree.asGraph(), subTree.asGraph());
  
      MutableCTreeNetwork<String, Integer> childOneSubTree = TreeUtils.getSubTree(tree, "child1");
  
      MutableCTreeNetwork<String, Integer> expectedSubTree =
          TreeNetworkBuilder.builder().expectedNodeCount(3).build();
      expectedSubTree.addNode("child1");
      expectedSubTree.addEdge("child1", "grandchild11", 11);
      expectedSubTree.addEdge("child1", "grandchild12", 12);
  
      assertEquals(childOneSubTree.asGraph(), expectedSubTree.asGraph());
    }
test_case.class_method_signature: TreeUtilsTest.testSubTree()
test_case.full_signature: @Test public void testSubTree()
test_case.identifier: testSubTree
test_case.invocations: build expectedNodeCount builder addNode addEdge addEdge addEdge addEdge addEdge addEdge getSubTree assertEquals asGraph asGraph getSubTree build expectedNodeCount builder addNode addEdge addEdge assertEquals asGraph asGraph
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSubTree()
focal_class.file: jung-api/src/main/java/edu/uci/ics/jung/graph/util/TreeUtils.java
focal_class.identifier: TreeUtils
focal_class.class_method_signature: TreeUtils.roots(Graph<N> graph)
focal_class.full_signature: public static ImmutableSet<N> roots(Graph<N> graph)
focal_class.identifier: roots
focal_class.modifiers: public static
focal_class.parameters: (Graph<N> graph)
focal_class.return: ImmutableSet<N>
focal_class.signature: ImmutableSet<N> roots(Graph<N> graph)
focal_class.class_method_signature: TreeUtils.isForestShaped(Graph<N> graph)
focal_class.full_signature: public static boolean isForestShaped(Graph<N> graph)
focal_class.identifier: isForestShaped
focal_class.modifiers: public static
focal_class.parameters: (Graph<N> graph)
focal_class.return: boolean
focal_class.signature: boolean isForestShaped(Graph<N> graph)
focal_class.class_method_signature: TreeUtils.isForestShaped(Network<N, ?> graph)
focal_class.full_signature: public static boolean isForestShaped(Network<N, ?> graph)
focal_class.identifier: isForestShaped
focal_class.modifiers: public static
focal_class.parameters: (Network<N, ?> graph)
focal_class.return: boolean
focal_class.signature: boolean isForestShaped(Network<N, ?> graph)
focal_class.class_method_signature: TreeUtils.getSubTree(CTreeNetwork<N, E> tree, N root)
focal_class.full_signature: public static MutableCTreeNetwork<N, E> getSubTree(CTreeNetwork<N, E> tree, N root)
focal_class.identifier: getSubTree
focal_class.modifiers: public static
focal_class.parameters: (CTreeNetwork<N, E> tree, N root)
focal_class.return: MutableCTreeNetwork<N, E>
focal_class.signature: MutableCTreeNetwork<N, E> getSubTree(CTreeNetwork<N, E> tree, N root)
focal_class.class_method_signature: TreeUtils.growSubTree(
        CTreeNetwork<N, E> tree, MutableCTreeNetwork<N, E> subTree, N root)
focal_class.full_signature: public static void growSubTree(
        CTreeNetwork<N, E> tree, MutableCTreeNetwork<N, E> subTree, N root)
focal_class.identifier: growSubTree
focal_class.modifiers: public static
focal_class.parameters: (
        CTreeNetwork<N, E> tree, MutableCTreeNetwork<N, E> subTree, N root)
focal_class.return: void
focal_class.signature: void growSubTree(
        CTreeNetwork<N, E> tree, MutableCTreeNetwork<N, E> subTree, N root)
focal_class.class_method_signature: TreeUtils.addSubTree(
        MutableCTreeNetwork<N, E> tree,
        CTreeNetwork<N, E> subTree,
        N subTreeParent,
        E connectingEdge)
focal_class.full_signature: public static void addSubTree(
        MutableCTreeNetwork<N, E> tree,
        CTreeNetwork<N, E> subTree,
        N subTreeParent,
        E connectingEdge)
focal_class.identifier: addSubTree
focal_class.modifiers: public static
focal_class.parameters: (
        MutableCTreeNetwork<N, E> tree,
        CTreeNetwork<N, E> subTree,
        N subTreeParent,
        E connectingEdge)
focal_class.return: void
focal_class.signature: void addSubTree(
        MutableCTreeNetwork<N, E> tree,
        CTreeNetwork<N, E> subTree,
        N subTreeParent,
        E connectingEdge)
focal_class.class_method_signature: TreeUtils.addFromSubTree(
        MutableCTreeNetwork<N, E> tree, CTreeNetwork<N, E> subTree, N subTreeRoot)
focal_class.full_signature: private static void addFromSubTree(
        MutableCTreeNetwork<N, E> tree, CTreeNetwork<N, E> subTree, N subTreeRoot)
focal_class.identifier: addFromSubTree
focal_class.modifiers: private static
focal_class.parameters: (
        MutableCTreeNetwork<N, E> tree, CTreeNetwork<N, E> subTree, N subTreeRoot)
focal_class.return: void
focal_class.signature: void addFromSubTree(
        MutableCTreeNetwork<N, E> tree, CTreeNetwork<N, E> subTree, N subTreeRoot)
focal_method.body: public static <N, E> MutableCTreeNetwork<N, E> getSubTree(CTreeNetwork<N, E> tree, N root) {
      checkNotNull(tree, "tree");
      checkNotNull(root, "root");
      checkArgument(
          tree.nodes().contains(root), "Input tree does not contain the input subtree root");
      MutableCTreeNetwork<N, E> subtree = TreeNetworkBuilder.from(tree).withRoot(root).build();
      growSubTree(tree, subtree, root);
  
      return subtree;
    }
focal_method.class_method_signature: TreeUtils.getSubTree(CTreeNetwork<N, E> tree, N root)
focal_method.full_signature: public static MutableCTreeNetwork<N, E> getSubTree(CTreeNetwork<N, E> tree, N root)
focal_method.identifier: getSubTree
focal_method.invocations: checkNotNull checkNotNull checkArgument contains nodes build withRoot from growSubTree
focal_method.modifiers: public static
focal_method.parameters: (CTreeNetwork<N, E> tree, N root)
focal_method.return: MutableCTreeNetwork<N, E>
focal_method.signature: MutableCTreeNetwork<N, E> getSubTree(CTreeNetwork<N, E> tree, N root)