A graph similarity for deep learning