public boolean isomorphicTo(IsomorphismCalculator rhs) { assert mappingInvariantsSatisfied() : "Bug detected. Should never happen"; return size == rhs.size && getNumberOfBlackNodes() == rhs.getNumberOfBlackNodes() && characterisationSetSizesMatch(rhs) && nodesCanBeMapped(rhs); }
private boolean characterisationSetSizesMatch(IsomorphismCalculator rhs) { for (Entry<NodeCharacterisation, Set<Integer>> entry : getCharacterisationToNodesMapping().entrySet()) { Set<Integer> rhsSet = rhs.getCharacterisationToNodesMapping().get(entry.getKey()); if (rhsSet == null || entry.getValue().size() != rhsSet.size()) { return false; } } return true; }
private Set<Integer> findCandidateMappingsBasedOnNodeCharacterisation( Integer node, IsomorphismCalculator rhs) { NodeCharacterisation nodeCharacterisation = getNodeToCharacterisationMapping().get(node); return new HashSet<Integer>(rhs.getCharacterisationToNodesMapping().get(nodeCharacterisation)); }