From: Sebastian Egner <sebastian.egner@philips.com>
To: Christian Lindig <lindig@cs.uni-sb.de>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] efficient binary relations?
Date: Fri, 31 Mar 2006 14:50:28 +0200 [thread overview]
Message-ID: <OFC99B0F81.298F7B60-ONC1257142.00424AC7-C1257142.0046A500@philips.com> (raw)
In-Reply-To: <4120ea8c70420ccd2f670bd9e4433527@cs.uni-sb.de>
[-- Attachment #1: Type: text/plain, Size: 1670 bytes --]
Hello Christian,
Please could you clarify the circumstances a little bit?
1. Are you looking for a data structure that you set
up for a fixed R once and then query many times for
different X? Or are you looking for a dynamic data
structure in which you keep changing R? Or are you
looking for a 'functional data structure' where the
older versions of R are preserved? Or for a functional
data structure where R is fixed, but the queries X
are constructed incrementally?
2. Is R sparse, i.e. is |R| << |\X|*|\Y|?
If not, bitvectors might not be so bad after all.
If yes, you might want to look for a data structure
storing the sets {x}' = {y : (x, y) in R} in such a
way that they can be intersected efficiently. If R
is fixed, {x}' can be represented as a sorted array
of the elements. These arrays can be intersected
quickly (see Knuth/TACP) but the asymptotically optimal
algorithms are rather tricky (if I recall correctly,
Knuth doesn't give them directly but only cites them).
A straight-forward algorithm is taking the shorter array
and looking up the elements in the longer one by binary
search. This nicely generalizes to your case of computing
X' for a given X: Get all {x}' for x in X and sort them
into increasing |{x}'|; this takes O(|X| log |X|).
Then for all y in {x}', x such that |{x}'| is minimal,
look up y in {u}' by binary search for all u in X\{x}
or until it is not found anymore; this takes
O(Sum[log |{u}'| : u in X\{x}]) per candidate y.
Simplifying the estimation (aehem...) you end up with
O( min { |{x}'| : x in X } * |X| log max { |{x}'| : x in X } ),
which is at least independent on |\Y|, if that is your
main concern.
Sebastian.
[-- Attachment #2: Type: text/html, Size: 2827 bytes --]
next prev parent reply other threads:[~2006-03-31 12:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-31 11:56 Christian Lindig
2006-03-31 12:21 ` [Caml-list] " skaller
2006-03-31 12:42 ` Christian Lindig
2006-03-31 12:50 ` Sebastian Egner [this message]
2006-03-31 13:42 ` Christian Lindig
2006-03-31 12:39 yoann padioleau
[not found] <28871572.1143807766574.JavaMail.www@wwinf1529>
2006-03-31 13:24 ` Christian Lindig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=OFC99B0F81.298F7B60-ONC1257142.00424AC7-C1257142.0046A500@philips.com \
--to=sebastian.egner@philips.com \
--cc=caml-list@inria.fr \
--cc=lindig@cs.uni-sb.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).