Talk:Allen's interval algebra

Untitled
For the example, one can infer newspaper { <, m }  bed.

I think the above is wrong. If reading the newspaper happens during dinner (meaning it doesn't finish dinner, some dinnertime is left after finishing reading the newspaper) it does not meet going to bed, merely precedes it.

IP Ranges
Daris A Nevil independently "re-discovered" Allen's interval algebra in April 2019, but applied to IP address ranges. Comparison of two IP ranges is a challenge. The goal here is to help a database sort the ranges so that the more specific ranges occur first.

The solution presented here was worked out using the following chart.

[ represent a_lo ] represents a_hi < represents b_lo > represents b_hi Please note that a_lo >= a_hi, and b_lo >= b_hi

Return values -1 means A should appear before B  0 means A is equal to B   1 means B should appear before A

Please note values are sorted in descending order. This allows the iterator to move forward when searching for inferior subnets.

Case #  return --  --    1         1       [---A---]             10.100.0.0/16 (10.100.0.0 - 10.100.255.255) <--B-->   10.102.0.0/16 (10.102.0.0 - 10.102.255.255)

2        1       [---A---]             (10.100.0.0 - 10.100.255.255) <--B-->      (10.100.255.255 - 10.101.255.255)

3        1       [---A---]             (10.100.0.0 - 10.100.200.255) <--B-->         (10.100.200.0 - 10.100.255.255)

4        1       [---A---]             10.100.0.0/16   (10.100.0.0 - 10.100.255.255) <--B-->            10.100.192.0/20 (10.100.192.0 - 10.100.255.255

5        1       [---A---]             10.100.0.0/16  (10.100.0.0 - 10.100.255.255) <--B-->             10.100.192.0/24 (10.100.192.0 - 10.100.192.255)

6        1       [---A---]             10.100.0.0/16 (10.100.0.0 - 10.100.255.255) <--B-->              10.100.0.0/24 (10.100.0.0 - 10.100.0.255)

7        0       [---A---]             10.100.0.0/16 (10.100.0.0 - 10.100.255.255) <---B--->            10.100.0.0/16 (10.100.0.0 - 10.100.255.255)

8       -1       <---B--->             10.100.0.0/16 (10.100.0.0 - 10.100.255.255) [--A--]              10.100.0.0/24 (10.100.0.0 - 10.100.0.255)

9       -1       <---B--->             10.100.0.0/16  (10.100.0.0 - 10.100.255.255) [--A--]             10.100.192.0/24 (10.100.192.0 - 10.100.192.255)

10       -1       <---B--->             10.100.0.0/16   (10.100.0.0 - 10.100.255.255) [--A--]            10.100.192.0/20 (10.100.192.0 - 10.100.255.255)

11       -1       <--B-->               (10.100.0.0 - 10.100.200.255) [---A---]        (10.100.200.0 - 10.100.255.255)

12       -1       <--B-->               (10.100.0.0 - 10.100.255.255) [---A---]      (10.100.255.255 - 10.101.255.255)

13       -1       <--B-->               10.100.0.0/16 (10.100.0.0 - 10.100.255.255) [---A---]   10.102.0.0/16 (10.102.0.0 - 10.102.255.255)

Dnevil (talk) 21:57, 12 February 2024 (UTC)