I'm computing a spatial weights matrix in PySAL using Queens Contiguity. My problem is that I would like to consider areas that are contiguous to the first set of neighbours (ie. 2nd or even 3rd order contiguity.)

Reading the docs here...


...leads me to conclude that higher order contiguity is not possible with the Queens weighting in PySAL since I can't find a parameter for it.

GeoDa seems to have the option as illustrated here:

GeoDa Queens dialog

Source: https://geodacenter.github.io/workbook/4a_contig_weights/lab4a.html#queen-contiguity

Am I missing something or is it not possible in PySAL?


This can be accomplished using higher order weights.

  • Great, that makes sense and is very flexible. To elaborate for those finding this answer later the function is called weights.higher_order and can be applied to any weights object. So in my case I compute Queens Contiguity and output the weight object w and then supply that to the higher_order function with my desired k-value for the order. – hexamon May 27 '20 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.