Sort by two criteria: x and index, in that order, so if there's two points on the same X, the index controls order. Indices are unique so such 2 criteria are enough.
Quadratic Sort (Pre B3.4)
$O(n^2)$ - for each vert, entire geometry This is duplicated. I don't know how it compares to convex hull algorithm, which I'd consider a hacky solution - you're relying on undocumented implementation details - still, quite awesome, so keep it coming!
(left Transfer Attribute could be replaced with Field at Index node)
Accumulate Field counts for each vertex how many other vertices are either before it on X, or exactly on the same X but have lower index. That's the numberone of verticesoutdated answers that should have lower indices, and sowould unnecessarily bury (in 0-based indexingcurrently) it's the desired index ofobjectively the currently evaluated vertexbest - which is saved as ID:
For clarity, this is how you would useanswer by quellenform. You can still access this data to repositionanswer by reading the vertices: