lists of pairs
- To: mathgroup at smc.vnet.net
- Subject: [mg8528] lists of pairs
- From: Russell Towle <rustybel at foothill.net>
- Date: Thu, 4 Sep 1997 02:20:30 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Hi all, many thanks to all who responded to my question about how to remove "reversed" pairs of integers from a list of pairs. As it happens I found the answer immediately after posting the query, in one of Jeffrey Adams' packages, entitled "PolytopeObjects." The solution I found there was identical to that proposed by most of you. For a list of integer pairs named "edges," Union [ Sort /@ edges ] does the trick quite nicely and quickly. Also, much to my distress, Will Self alerted me to the fact that my example list of edges was not composed entirely of double-pairs {a, b} and {b, a}, a horrible horrible mistake on my part. Sorry about that! The reason why the list always arises as reversed pairs is that it is derived from a list of polygons bounding a polyhedron. Each polygon shares an edge, and if all the polygons have their vertices ordered consistently (counter-clockwise, say, as seen from outsode the polyhedron), then each edgee occurs twice in the list, as {a, b} and {b, a}. --Russell Towle