pysal.lib.weights.
w_symmetric_difference
(w1, w2, w_shape='all', constrained=True, silence_warnings=False)[source]¶Returns a binary weights object, w, that includes only neighbor pairs that are not shared by w1 and w2. The w_shape and constrained parameters determine which pairs that are not shared by w1 and w2 are returned.
Parameters: 


Returns: 

Notes
ID comparisons are performed using ==, therefore the integer ID 2 is equivalent to the float ID 2.0.
Examples
Construct queen weights matrix for a 4x4 (16 areas) region (w1) and a rook matrix for a 6x4 (24 areas) region (w2). The symmetric difference of these two matrices (with w_shape set to ‘all’ and constrained set to False) contains the corner joins in the overlap area, all the joins in the nonoverlap area.
>>> from pysal.lib.weights import lat2W
>>> import pysal.lib
>>> w1 = lat2W(4,4,rook=False)
>>> w2 = lat2W(6,4,rook=True)
>>> w = pysal.lib.weights.set_operations.w_symmetric_difference(w1, w2, constrained=False)
>>> w1[0] == w[0]
False
>>> w1.neighbors[15]
[10, 11, 14]
>>> w2.neighbors[15]
[11, 14, 19]
>>> set(w.neighbors[15]) == set([10, 19])
True
>>>