public Map<String,Integer> getEdges( TreeNode node ){ Map<String,Integer> edges = new LinkedHashMap<String,Integer>(); for( TreeNode ch : node.children() ){ String edge = node.getLabel().trim() + "->" + ch.getLabel().trim(); Integer count = edges.get( edge ); if( count == null ){ count = 1; } else count += 1; edges.put( edge, count ); edges = add( edges, getEdges( ch ) ); } return edges; }
public Map<String,Integer> getEdges( TreeNode node ){ Map<String,Integer> edges = new LinkedHashMap<String,Integer>(); for( TreeNode ch : node.children() ){ String edge = node.getLabel().trim() + "->" + ch.getLabel().trim(); Integer count = edges.get( edge ); if( count == null ){ count = 1; } else count += 1; edges.put( edge, count ); edges = add( edges, getEdges( ch ) ); } return edges; }
public Map<String,Integer> getEdges( TreeNode node ){ Map<String,Integer> edges = new LinkedHashMap<String,Integer>(); for( TreeNode ch : node.children() ){ String edge = node.getLabel().trim() + "->" + ch.getLabel().trim(); Integer count = edges.get( edge ); if( count == null ){ count = 1; } else count += 1; edges.put( edge, count ); edges = add( edges, getEdges( ch ) ); } return edges; }