Boundary of MultiLinestring in DE-9IM

can somebody help me understand (probably giving visual examples) what does this sentence mean which is quoted from the wiki page of nine intersection model:

Those points that are in the boundaries of an odd number of its elements (curves).

https://en.wikipedia.org/wiki/DE-9IM

I run the following example in R:

elem1 <- matrix(c(0,0,0,1),2)
elem2 <- matrix(c(0,0,0,-1),2)
elem3 <- matrix(c(0,-1,0,0),2)
elem4 <- matrix(c(0,0,-1,-2),2)

mls <- sf::st_multilinestring(list(elem1,elem2,elem3,elem4))
plot(mls,type='o')

sf::st_boundary(mls)

The output is all 4 points on the boundaries of each individual element.

MULTIPOINT(-1 0, 0 -2, 0 0, 0 1) • I am not sure, but in case of a linestring the two end points are the boundary. If in multilinestring two elements (lines) touch and thus have a common end point, that does not belong to boundary of multilinestring. But if three lines touch at one point then the common point again belongs to boundary. That's how I read it even I do not claim that I understand it. May 2 '17 at 21:04
• While your explanation is relatively intuitive , have you tested them anywhere? i.e. in PostGIS etc? May 2 '17 at 23:00
• In your example all poinst are shared by odd number of elements, either one or three. Add one more line to your own example so that it connects to the downmost vertex. By the "shared by odd number of elements" that vertex should disappear from the boundary. Same thing if you add a fourth element to the joint in the middle, the central point should disappear because it is shared by even number of elements. May 3 '17 at 6:07
• @user30184 perfect. You are right. Post it as answer and I will mark. May 3 '17 at 23:12