code: private DNode calculateSourceNode() {
          DNode result = DNode.NOT_FOUND;
          
          for (DNode node : nodes) {
              List<DLink> links = getLinksTo(node);
              if (links.size() == 0) {
                  result = node;
                  break;
              }
          }
          return result;
      }
docs: Finds the first node with no incoming links.