code: public static void main(String[] args) {
      Tree t;
      try {
        t = Tree.valueOf("(S (NP (NNP Sam)) (VP (VBD died) (NP-TMP (NN today))))");
      } catch (Exception e) {
        System.err.println("Horrible error: " + e);
        e.printStackTrace();
        return;
      }
  
      t.pennPrint();
  
      System.out.println("----------------------------");
      TreeGraph tg = new TreeGraph(t);
      System.out.println(tg);
  
      tg.root.percolateHeads(new SemanticHeadFinder());
      System.out.println("----------------------------");
      System.out.println(tg);
  
  //    TreeGraphNode node1 = tg.getNodeByIndex(1);
  //    TreeGraphNode node4 = tg.getNodeByIndex(4);
  //    node1.addArc("1to4", node4);
  //    node1.addArc("1TO4", node4);
  //    node4.addArc("4to1", node1);
  //    System.out.println("----------------------------");
  //    System.out.println("arcs from 1 to 4: " + node1.arcLabelsToNode(node4));
  //    System.out.println("arcs from 4 to 1: " + node4.arcLabelsToNode(node1));
  //    System.out.println("arcs from 0 to 4: " + tg.root.arcLabelsToNode(node4));
  //    for (int i = 0; i <= 9; i++) {
  //      System.out.println("parent of " + i + ": " + tg.getNodeByIndex(i).parent());
  //      System.out.println("highest node with same head as " + i + ": " + tg.getNodeByIndex(i).highestNodeWithSameHead());
  //    }
    }
docs: Just for testing.