@Override
    public void generateLinks() {
        List<Node> nodeList = networkStructurer.getNodeList();
        final Iterator<Node> it1 = nodeList.iterator();
        
        while (it1.hasNext()) {
            Node node1 = it1.next();
            Iterator<Node> it2 = nodeList.iterator();
            
            while (it2.hasNext()) {
                Node node2 = it2.next();
                
                // Since this method examines each pair of nodes twice (i.e.
                // 'node A and node B' as well as 'node B and node A'), it
                // effectively doubles the probability of generating a link. To
                // compensate, we divide the link probability in half.
                //
                // Also check that we aren't connecting a node to itself and
                // that node1 isn't already connected to node2 (as node1 to
                // node2 and node2 to node1 are the same link and should not
                // be connected twice).
                if (Math.random() < linkProbability * 0.5 && node1 != node2 &&
                        !node1.isConnectedTo(node2)) {
                    new Link(node1.getNodeID(), node2.getNodeID(),
                            networkStructurer);
                }
            }
        }
    }