private void hashGraphCountCollisions(NamedGraph g){
		//Sort triples in graph by their hash values
		Collections.sort(g.getTriples(), new Comparator<Triple>() {
			public int compare(Triple t1, Triple t2) {
				if (t1.getHash()==null){
					throw new RuntimeException("hash of triple "+t1+" does not exist");
				}
				if (t2.getHash()==null){
					throw new RuntimeException("hash of triple "+t2+" does not exist");
				}				
				return t2.getHash().compareTo(t1.getHash());
			}
		});
		
		//Count hash collisions in statements
		BigInteger prevHash=null;
		for (Triple t:g.getTriples()){
			BigInteger curHash=t.getHash();
			if (curHash.equals(prevHash)){
				collisions++;
			}
			prevHash=curHash;
		}
		
		//Sort variable hashes by their hash values
		Collections.sort(g.getVariableHashes());
		
		//Count hash collisions in variables
		prevHash=null;
		for (NodeHash nh:g.getVariableHashes()){
			BigInteger curHash=nh.getHash();
			if (curHash.equals(prevHash)){
				collisions++;
			}
			prevHash=curHash;
		}
		
		//Count collisions in sub graphs
		for (NamedGraph subG:g.getChildren()){
			hashGraphCountCollisions(subG);
		}
	}