Thanks a lot for pointing that out.
euclidean function was a manually implemented function. I forgot to add it in the article and gist.
Since then, I have reviewed the code and made some changes. You can find the euclidean function above the
There are also some edits for the visualisation part.