Which data structure do you suggest for handling this data?

74 views
Skip to first unread message

MP

unread,
Oct 25, 2016, 3:43:59 PM10/25/16
to julia-users

Hi all,

I have a grid network with a number nodes with (x,y) coordinates, and I have a couple of individuals that visit these nodes in the network. For instance, individual 1 visits nodes (1,3), (4,5), (8,9) and individual 2 visits (4,3), (2,5). 

I need to access these nodes for each individual (let say in a for loop for all individuals) but I do not know the best way of doing it in Julia. 

Thanks in advance,

Michael Borregaard

unread,
Oct 26, 2016, 10:42:58 AM10/26/16
to julia-users
That depends a lot on what analyses you want to do with it afterwards - you could have an array (of species) of an array (of points) of tuples (the x and y), which is the most straigthforward thing.

For must uses I would probably use a sparse Boolean matrix, e.g.
visits = [sparse([1,4,8], [3,5,9], true), sparse([4,2],[3,5], true)]


Reply all
Reply to author
Forward
0 new messages