def Degree(adjmatrix, directed=False):
    """Computes the number of neighbours of every node.

    Parameters
    ----------
    adjmatrix : ndarray of rank-2
        The adjacency matrix of the network.
    directed: Boolean, optional
        True if the network is directed, False otherwise.

    Returns
    -------
    If 'directed=False':
    degarray : ndarray
        An array with the degree of every node in the undirected network.
    If 'directed=True'
    degarray : A tuple containing two ndarrays, indegarray and outdegarray.
        indegarray is the input degree of the every node and outdegarray is
        is the output degree of every node.

    See Also
    --------
    Intensity : Computes the weighted degree of networks.
    ReciprocalDegree : Reciprocity of every node and excess degrees.
    """
    N = len(adjmatrix)
    adjmatrix = adjmatrix.astype('bool')
    if directed:
        indegree = adjmatrix.sum(axis=0)
        outdegree = adjmatrix.sum(axis=1)
        return indegree, outdegree
    else:
        degree = adjmatrix.sum(axis=1)
        return degree
