caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] efficient binary relations?
@ 2006-03-31 12:39 yoann padioleau
  0 siblings, 0 replies; 6+ messages in thread
From: yoann padioleau @ 2006-03-31 12:39 UTC (permalink / raw)
  To: caml-list




 
> I am looking for an efficient representation of binary relations in 
> OCaml. I have used bitvectors in the past but would like to use a more 
> high-level and less imperative data structure.
> 
> The most important operation is the following. For a binary relation R 
> over \X x \Y compute for a set X the set X' = { y | (x,y) in  R for all 
> x in X}. In other words, X' is the set of y that are common to all x in 
> X. Likewise, Y' must be computed. This operation requires to compute 
> the intersection of sets and was the main reason I chose bitvectors. If 
> you know about a suitable data structure I would glad to hear about it.
 
If you can represent the y by integers, and that the binary relation 
have good property, such as the set of y related to a x (the extension of x in concept analysis ?)
often follows each other,  then you can represent sets  by  list of intervals.
For instance the set of integers from 200 to 400 and 500 to 550  by [(200,400);(500;550)].
Computing intersection with such sets can be quite fast.
You can also represent such sets by tree of intervals (there is a pearl on this in journal of functionnal
programming if I remember).

Then, when you want to compute the intersection of an important number of set, maybe you have
to re-order the intersection operations, for instance starting with the sets which have the less elements.

I think that in constraint programming they have such problems.



^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <28871572.1143807766574.JavaMail.www@wwinf1529>]
* efficient binary relations?
@ 2006-03-31 11:56 Christian Lindig
  2006-03-31 12:21 ` [Caml-list] " skaller
  2006-03-31 12:50 ` Sebastian Egner
  0 siblings, 2 replies; 6+ messages in thread
From: Christian Lindig @ 2006-03-31 11:56 UTC (permalink / raw)
  To: Caml List

I am looking for an efficient representation of binary relations in 
OCaml. I have used bitvectors in the past but would like to use a more 
high-level and less imperative data structure.

The most important operation is the following. For a binary relation R 
over \X x \Y compute for a set X the set X' = { y | (x,y) in  R for all 
x in X}. In other words, X' is the set of y that are common to all x in 
X. Likewise, Y' must be computed. This operation requires to compute 
the intersection of sets and was the main reason I chose bitvectors. If 
you know about a suitable data structure I would glad to hear about it.

-- Christian

--
http://www.st.cs.uni-sb.de/~lindig/


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-03-31 13:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-31 12:39 [Caml-list] efficient binary relations? yoann padioleau
     [not found] <28871572.1143807766574.JavaMail.www@wwinf1529>
2006-03-31 13:24 ` Christian Lindig
  -- strict thread matches above, loose matches on Subject: below --
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
2006-03-31 13:42   ` Christian Lindig

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).