I use SQLite to store a set of undirected edges of the graph using two columns: u and v. For instance:
uv
12
3 2
2 1
3 4
I already went through it with SELECT DISTINCT * FROM edge and deleted all duplicate rows.
However, if we remember, these are still duplicates, these are undirected edges. In the above example, the edge (1,2) appears twice, once as (1,2) and once (2,1), which are both equivalent.
I want to delete all such duplicates, leaving only one of them, either (1,2) or (2,1) - it doesn’t really matter which one.
Any ideas how to achieve this? Thank!