Skip to content
Prev 27628 / 29559 Next

Producing a conditional adjacency matrix

Hi Roger,

Including a bit more detail below (my apologies if this is just complete gibberish ? first time posting to a forum like this):

First, I add a random ID variable to the columbus dataset indicating the variable I?d like to base my exclusions on in the final neighbor list:
In my case, that produced the following IDs for the first 4 polyids:

POLYID 1: 3
POLYID 2: 2
POLYID 3: 3
POLYID 4: 1

Second, col.ga.nb indicates that each of the previous POLYID?s has the following neighbors
POLYID 1 (w new assigned ID of 3): 2, 3
POLYID 2 (? ? 2): 1, 3, 4
POLYID 3 (? ? 3): 1, 2, 4, 5
POLYID 4 (? ? 1): 2, 3, 5, 8

Third (or brevity?s sake) looking only at POLYID 1 (with new ID = 3):

Its neighbors from col.ga.nb (POLYID 2 and 3) have ID values of 3 and 1 respectively

My end goal would be to produce a new list in which POLYID 1?s only neighbor is POLYID 3 (with an ID of 1). POLYID 2 would be excluded, as its ID value matches its parent. 

The same would be true of each subsequent polygon. 

In essence, the same format you mentioned at the end of your reply: a glist including all neighbors j with a value of x not equal to x[i], and excluding all with x[j] == x[i].

Best,

Rhys