Hi Dimitriy and Kowshik,
You are right. If I deleted [1,1] and [2,2]. The code is able to run without any problem.
The filtration comes from a function on graphs. [1,1] and [2,2] corresponds to two self loops.
I should have checked if the graph has the self loops before computing the persistence diagram.
I filed this on the github already.