# Source code for landlab.graph.object.at_node

```import numpy as np

from ...core.utils import as_id_array

"""Set up data structures for node-to-link connectivity.

Parameters
----------
graph : Graph
A `Graph`.

Nodes at either end of a link (tail node, then head node).
number_of_nodes: int, optional
The total number of nodes. If not given, use the largest node in

Returns
-------
tuple of ndarray
"""

number_of_nodes = graph.number_of_nodes

max_node_count = np.max(node_count)

link_dirs_at_node = np.full((number_of_nodes, max_node_count), 0, dtype=np.int8)
links_at_node = np.full((number_of_nodes, max_node_count), -1, dtype=int)

if sort:
)

):

Parameters
----------
Links entering or leaving each node.
Direction of links entering or leaving each node.

Returns
-------
The sorted arrays. If `inplace` is `True`, these are the input
arrays.

Examples
--------
>>> import numpy as np

::

(1) - 1 -> (3)
|          ^
2          3
V          |
(0) - 0 -> (2)

>>> links_at_node = [[2, 0], [1, 2], [3, 0], [3, 1]]
>>> link_dirs_at_node = [[1, -1], [-1, -1], [-1, 1], [1, 1]]
>>> angle_of_link = np.array([0., 0., -90., 90.]) * np.pi / 180.

The first item of the returned tuple is links at each node sorted
counterclockwise by angle.

>>> out[0] # doctest: +NORMALIZE_WHITESPACE
array([[0, 2], [2, 1], [3, 0],  [1, 3]])

The second item is the direction of the link (entering or leaving).

>>> out[1] # doctest: +NORMALIZE_WHITESPACE
array([[-1,  1], [-1, -1], [-1,  1], [ 1,  1]], dtype=int8)

Because the input arrays are lists, not numpy arrays, the sort is not
in-place.

True

>>> links_at_node = np.asarray([[2, 0], [1, 2], [3, 0], [3, 1]], dtype=int)
>>> link_dirs_at_node = np.asarray([[1, -1], [-1, -1], [-1, 1], [1, 1]], dtype=np.int8)
>>> angle_of_link = np.array([0., 0., -90., 90.]) * np.pi / 180.

array([[0, 2], [2, 1], [3, 0],  [1, 3]])
array([[-1,  1], [-1, -1], [-1,  1], [ 1,  1]], dtype=int8)
"""

out = (
)

if inplace and (out[0] is not links_at_node or out[1] is not link_dirs_at_node):
raise ValueError(
)

if not inplace: