added topological distance variable