Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76561

Collaps arrays/ list of intergers

Newsgroups comp.lang.python
Date 2014-08-19 05:54 -0700
Message-ID <fb9b097d-1a25-4f28-9b3f-61636e013a91@googlegroups.com> (permalink)
Subject Collaps arrays/ list of intergers
From Jurgens de Bruin <debruinjj@gmail.com>

Show all headers | View raw


Hi All,

I do hope somebody can help me with the following:
I have the followings lists which represent the upper and lower value of a range/array.

a = [1,50]
b = [75,150]
c = [25,42]
d = [120,149]
e = [35,55]

What I would like to happen is that overlapping range will "collapse" to a single range meaning the above list would become:

as list a,c and e overlap they can be represented by
f = [1,55]
as list b and d overlap they can be represented by 
g = [75,150]

I have sort of got working solution using networkx and numpy and they work perfect for the above example the problem I have no is my true data set looks more like the following:

x = [135098,19854736]
y = [135098,41639553]
z = [11818998,12587339]

To give only three examples using networkx and numpy does not work as this results in memory error due to the ranges being so large.

I would appreciate any help with this.

Thanks

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Collaps arrays/ list of intergers Jurgens de Bruin <debruinjj@gmail.com> - 2014-08-19 05:54 -0700
  Re: Collaps arrays/ list of intergers Peter Pearson <ppearson@nowhere.invalid> - 2014-08-19 16:22 +0000
    Re: Collaps arrays/ list of intergers Rock Neurotiko <miguelglafuente@gmail.com> - 2014-08-19 19:27 +0200
  Re: Collaps arrays/ list of intergers Peter Otten <__peter__@web.de> - 2014-08-19 19:52 +0200
  Re: Collaps arrays/ list of intergers Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-19 19:05 +0000

csiph-web