public void chooseSourceAndTargets() {
        /*
         * For simplicity, I am putting only one target per search query.
         * This can be expanded at a later point to permit multiple targets.
         */
        final int nTargets = 1;
        
        for (int iQuery = 0; iQuery < searchQueriesMap.size(); iQuery++) {
            final Query currentQuery = searchQueriesMap.get(iQuery);
            
            /* Generates source. */
            int randomNodeID =
                    (int) Math.floor(Math.random() *
                            networkStructurer.getNodeList().size());
            final Node sourceNode = networkStructurer.getNodeByID(randomNodeID);
            currentQuery.setSourceNode(sourceNode);
            
            /* Actions to take if a source has no neighbours. */
            if (sourceNode.getLinksSet().size() == 0) {
                final String noNeighboursQuery2String =
                        "FAILURE. Source node for one of the queries has no neighbours.";
                searchCoordinator.getControlPanel().getResultLabel().setText(
                        "<html>" + noNeighboursQuery2String + "</html>");
                searchCoordinator.setFlagSearchComplete(1);
                
//                double retryPercentage = 0.2;  // percentage of total nodes
//                // in the network acting as the upper limit of nodes to test to
//                // see if they have neighbours
//
//                int nRetries =
//                    (int) Math.floor(searchCoordinator.getNetworkStructurer()
//                        .getNodeSet().size() *
//                        retryPercentage);
//
//                /* Retries to find a source node with neighbours. */
//                while ((nRetries > 0) && (sourceNode.getLinksSet().size() == 0)) {
//                    randomNodeID =
//                        (int) Math.floor(Math.random() *
//                            networkStructurer.getNodeSet().size());
//                    sourceNode = networkStructurer.getNodeByID(randomNodeID);
//                    nRetries--;
//                }
//
//                /* Ends search if no suitable source node could be found. */
//                if (nRetries == 0) {
//                    System.out
//                        .println("Could not find a source node with neighbours. "
//                            + "Please reconsider your network parameters.");
//                    searchCoordinator.getControlPanel().getResultLabel().setText(
//                        "Search ended: could not find a source node with neighbours. "
//                            + "Please reconsider your network parameters.");
//
//                    searchCoordinator.setFlagSearchComplete(1);
//                }
            }
            
            /* Adds source to set of current nodes. */
            currentQuery.getCurrentNodesSet().add(sourceNode);
            
            /* Adds source to set of visited nodes. */
            currentQuery.getVisitedNodesSet().add(sourceNode);
            
            /* Generates targets. Does not allow target and source to be the same. */
            for (int iTarget = 0; iTarget < nTargets; iTarget++) {
                Node targetNode;
                do {
                    randomNodeID =
                            (int) Math.floor(Math.random() *
                                    networkStructurer.getNodeList().size());
                } while (randomNodeID == sourceNode.getNodeID());
                
                targetNode = networkStructurer.getNodeByID(randomNodeID);
                currentQuery.getTargetNodesSet().add(targetNode);
            }
        }
    }