landlab.graph.matrix.at_node

Get links and their directions at each node.

Parameters:

nodes_at_link (ndarray of int, shape (n_links, 2)) – Node identifier for each link tail and head.

Returns:

Tuple of link identifiers for each node, link directions for each node and offsets into these arrays for each node.

Return type:

tuple of ndarray of int

Examples

::

0 – 1 | | 2 – 3 - 4

>>> import numpy as np
>>> nodes_at_link = np.array([[2, 3], [3, 4], [2, 0], [3, 1], [4, 1], [0, 1]])
>>> (links_at_node, link_dirs_at_node, offset_to_node) = get_links(nodes_at_link)
>>> links_at_node
array([2, 5, 3, 4, 5, 0, 2, 0, 1, 3, 1, 4])
>>> link_dirs_at_node
array([ 1, -1,  1,  1,  1, -1, -1,  1, -1, -1,  1, -1], dtype=int8)
>>> offset_to_node
array([ 0,  2,  5,  7, 10, 12])