Intrinsic dimension estimation for discrete metrics