Yeah. I didn't implement it to check the "going back" lines.
For instance, if you have 3 particles A, B and C, there are 3 lines: AB, AC and BC. In my implementation it will create AB, AC, BA (which is, essentialy AB backwards), BC, CA (again, AC) and CB (again, BC). The idea was just to show you how to go with the lines. You should treat the code to skip already drawn lines...
EDIT: in fact, I think it is even drawing lines towards themselves...