public int calculateTotalNumberOfLinks() {
        int nTotalDirectedLinks = 0;
        int nTotalUndirectedLinks = 0;
        
        /* Iterates over each node in the set of network nodes. */
        final Iterator<Node> itCurrentNodes = nodeList.iterator();
        Node aCurrentNode;
        
        while (itCurrentNodes.hasNext()) {
            aCurrentNode = itCurrentNodes.next();
            
            /* Iterates over each link in the set of links of the current node. */
            final Iterator<Link> itLink = aCurrentNode.getLinksSet().iterator();
            Link aCurrentLink;
            
            while (itLink.hasNext()) {
                aCurrentLink = itLink.next();
                
                if (aCurrentLink.getLinkType() == LinkType.UNDIRECTED) {
                    nTotalUndirectedLinks++;
                }
                else if (aCurrentLink.getLinkType() == LinkType.DIRECTED) {
                    nTotalDirectedLinks++;
                }
            }
        }
        
        /*
         * Test that the number of undirected links is even, as it should be.
         * Otherwise, signal that there's a problem.
         */
        if ((nTotalUndirectedLinks % 2) == 0) {
            return (nTotalUndirectedLinks / 2) + nTotalDirectedLinks;
        }
        else {
            return -1;
        }
    }