there is the better one (!) taking into account the mxs specifics:
fn searchEndEdges3 ep =
(
getEdgeVert = ep.GetEdgeVertex
ee = ep.GetSelection #edge
vx = #{}
vy = #{}
for e in ee do
(
v = getEdgeVert e 1
append (if vx[v] then vy else vx) v
v = getEdgeVert e 2
append (if vx[v] then vy else vx) v
)
verts = vx - vy
edges = #{}
ep.getedgesusingvert edges verts
return #(verts, edges * ee)
)
generally it’s two times faster
Jorge, i suggest to split the first place as usually 
