@Override
    public void chooseSourceAndTargets() {
        /*
         * Chooses the source and target for the first query.
         */
        final Query query1 = searchQueriesMap.get(0);
        
        /* Generates source. */
        int randomNodeID =
                (int) Math.floor(Math.random() *
                        networkStructurer.getNodeList().size());
        final Node sourceNode = networkStructurer.getNodeByID(randomNodeID);
        query1.setSourceNode(sourceNode);
        
        /* Checks to see if source has no neighbours. */
        if (sourceNode.getLinksSet().size() == 0) {
            final String noNeighboursQuery1String =
                    "FAILURE. Source node for one of the queries has no neighbours.";
            searchCoordinator.getControlPanel().getResultLabel().setText(
                    "<html>" + noNeighboursQuery1String + "</html>");
            searchCoordinator.setFlagSearchComplete(1);
        }
        
        /* Adds source to set of current nodes. */
        query1.getCurrentNodesSet().add(sourceNode);
        
        /* Adds source to set of visited nodes. */
        query1.getVisitedNodesSet().add(sourceNode);
        
        /* Generates target. Does not allow target and source to be the same. */
        Node targetNode;
        do {
            randomNodeID =
                    (int) Math.floor(Math.random() *
                            networkStructurer.getNodeList().size());
        } while (randomNodeID == sourceNode.getNodeID());
        
        targetNode = networkStructurer.getNodeByID(randomNodeID);
        query1.getTargetNodesSet().add(targetNode);
        
        /*
         * Chooses the source and target for the second query.
         *
         * The target of the first query becomes the source for the second,
         * while the source of the first query becomes the target for the second
         * (hence the reason for using "targetNode" in place of where one might
         * normally expect to see "sourceNode."
         */
        final Query query2 = searchQueriesMap.get(1);
        
        /* Generates source. */
        query2.setSourceNode(targetNode);
        
        /* Checks to see if source has no neighbours. */
        if (targetNode.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);
        }
        
        /* Adds source to set of current nodes. */
        query2.getCurrentNodesSet().add(targetNode);
        
        /* Adds source to set of visited nodes. */
        query2.getVisitedNodesSet().add(targetNode);
        
        /* Generates target. */
        query2.getTargetNodesSet().add(sourceNode);
    }