code: private Map<Link, Boolean> getFirstPhysicalPath(Map<Link, Boolean> currentPath, Switch sw, Node dst) {
  
          // Iterate through the current switch's links
          for (Link l : net.getConnectedLinks(sw)) {
              // Wrong link
              if (currentPath.containsKey(l)) {
                  continue;
              }
  
              /*
               * Go through the link and track the direction for full-duplex purpose
               * From switch to element => false : DownLink
               * From element to switch => true : UpLink
               */
              currentPath.put(l, !l.getSwitch().equals(sw));
  
              // Check what is after
              if (l.getElement() instanceof Node) {
                  // Node found, path complete
                  if (l.getElement().equals(dst)) {
                      return currentPath;
                  }
              }
              else {
                  // Go to the next switch
                  Map<Link, Boolean> recall = getFirstPhysicalPath(
                          currentPath, l.getSwitch().equals(sw) ? (Switch) l.getElement() : l.getSwitch(), dst);
                  // Return the complete path if found
                  if (!recall.isEmpty()) {
                      return recall;
                  }
              }
              // Wrong link, go back
              currentPath.remove(l);
          }
          // No path found through this switch
          return new LinkedHashMap<>();
      }
docs: Recursive method to get the first physical path found from a switch to a destination node
  
  @param   currentPath the current or initial path containing the link(s) crossed
  @param   sw the current switch to browse
  @param   dst the destination node to reach
  @return  the ordered list of links that make the path to dst