# Source code for landlab.graph.quantity.of_link

```import numpy as np

"""Get angles of links in a graph.

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

Returns
-------
ndarray of float
out : ndarray of float, optional
Buffer to place output.

Examples
--------
>>> import numpy as np
>>> from landlab.graph import UniformRectilinearGraph

>>> graph = UniformRectilinearGraph((2, 2))
>>> get_angle_of_link(graph) * 180. / np.pi
array([  0.,  90.,  90.,   0.])

>>> angles = np.empty(graph.number_of_links, dtype=float)
>>> rtn = get_angle_of_link(graph, out=angles)
>>> angles is rtn
True
"""
if out is None:
out = np.empty(graph.number_of_links, dtype=float)

np.arctan2(np.diff(y).flat, np.diff(x).flat, out=out)

return np.mod(out, 2.0 * np.pi, out=out)

"""Get xy position of the midpoint of links.

Parameters
----------
graph : `Graph`
A `Graph`.
out : ndarray of float, optional
Buffer to place output.

Returns
-------
ndarray of float, shape `(n_links, 2)`
Coordinates of link midpoints.

Examples
--------
>>> import numpy as np
>>> from landlab.graph import UniformRectilinearGraph

>>> graph = UniformRectilinearGraph((2, 2))
array([[ 0.5,  0. ],
[ 0. ,  0.5],
[ 1. ,  0.5],
[ 0.5,  1. ]])

>>> points = np.empty((graph.number_of_links, 2), dtype=float)
>>> rtn = get_midpoint_of_link(graph, out=points)
>>> points is rtn
True
"""

if out is None:
out = np.empty((graph.number_of_links, 2), dtype=float)