libpysal.weights.
netW
(link_list, share='A', transform='r')[source]¶Create a network-contiguity based weight object based on different nodal relationships encoded in a network.
Parameters: |
|
---|---|
Returns: |
|
Examples
>>> import libpysal
>>> links = [('a','b'), ('a','c'), ('a','d'), ('c','d'), ('c', 'b'), ('c','a')]
>>> O = libpysal.weights.spintW.netW(links, share='O')
>>> O.neighbors[('a', 'b')]
[('a', 'c'), ('a', 'd')]
>>> OD = libpysal.weights.spintW.netW(links, share='OD')
>>> OD.neighbors[('a', 'b')]
[('a', 'c'), ('a', 'd'), ('c', 'b')]
>>> any_common = libpysal.weights.spintW.netW(links, share='A')
>>> any_common.neighbors[('a', 'b')]
[('a', 'c'), ('a', 'd'), ('c', 'b'), ('c', 'a')]