Re: lists of pairs
- To: mathgroup at smc.vnet.net
- Subject: [mg8505] Re: lists of pairs
- From: Seth Chandler <SChandler at uh.edu>
- Date: Thu, 4 Sep 1997 02:19:49 -0400
- Organization: University of Houston
- Sender: owner-wri-mathgroup at wolfram.com
Russell Towle wrote:
> Hi all, I have a problem in discarding duplicates from a list of
> integer
> pairs, where if pairs of the form {a, b} and {b,a} exist in the list,
> I
> wish to discard (or select) only one, it doesn't matter which. The
> method
> I use below works, but is slow.
>
>
<snip>
> Suggestions? It is desired to minimize the time it takes to do this.
>
> Russell Towle
> Giant Gap Press: books on California history, digital topographic
> maps
> P.O. Box 141
> Dutch Flat, California 95714
> ------------------------------
> Voice: (916) 389-2872
> e-mail: rustybel at foothill.net
> ------------------------------
If z is your list of pairs with duplicates, how about Union[Map[Sort,z]]
Seth J. Chandler
Associate Professor of Law
University of Houston Law Center