@@ -0,0 +1,1233 @@
+package test;%0A%0A/**%0Ascala%3E map%0Ares6: java.util.HashMap%5BString,java.util.List%5BString%5D%5D = %7BAAA=%5BBBB, CCC, EEE%5D, CCC=%5BDDD%5D%7D%0A%0Ascala%3E test.Test.printCompany(map)%0A-AAA%0A -BBB%0A -CCC%0A  -DDD%0A -EEE%0A*/%0A%0Aimport java.util.HashMap;%0Aimport java.util.HashSet;%0Aimport java.util.List;%0A%0Apublic class Test %7B%0A  public static void printCompany(HashMap%3CString, List%3CString%3E%3E graph) %7B%0A    if (graph.size() == 0) return;%0A    HashSet%3CString%3E roots = new HashSet%3CString%3E();%0A    for (String v : graph.keySet()) %7B%0A      roots.add(v);%0A    %7D%0A%0A    for (String v : graph.keySet()) %7B%0A      for (String l : graph.get(v)) %7B%0A        roots.remove(l);%0A      %7D%0A    %7D%0A%0A    for (String v : roots) %7B%0A      printCompany(graph, v, 0);%0A    %7D%0A  %7D%0A%0A  private static void printCompany(HashMap%3CString, List%3CString%3E%3E graph, String vertex, int depth) %7B%0A    printVertex(vertex, depth);%0A    if (graph.containsKey(vertex)) %7B%0A      for (String v : graph.get(vertex)) %7B%0A        printCompany(graph, v, depth + 1);%0A      %7D%0A    %7D%0A  %7D%0A%0A  private static void printVertex(String vertex, int depth) %7B%0A    StringBuilder sb = new StringBuilder();%0A    for (int i = 0; i %3C depth; i++) %7B%0A      sb.append(%22 %22);%0A    %7D%0A    sb.append(%22-%22);%0A    sb.append(vertex);%0A    System.out.println(sb.toString());%0A  %7D%0A%7D%0A

add company-structure solution