Get a list of all nodes in the graph that are roots. A root is defined to be a node that has no input.
()
| 99 | * be a node that has no input. |
| 100 | */ |
| 101 | public List<E> getRoots() { |
| 102 | if (mRoots.size() == 0 && mOps.size() > 0) { |
| 103 | for (E op : mOps.keySet()) { |
| 104 | if (mToEdges.get(op) == null) { |
| 105 | mRoots.add(op); |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | return mRoots; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Get a list of all nodes in the graph that are leaves. A leaf is defined to |