Updated with affinity matrix
Updated with affinity matrix