def adjmat2vec(adjmat):
    """Convert adjacency matrix into vector with source and target.

    Parameters
    ----------
    adjmat : pd.DataFrame()
        Adjacency matrix.

    Returns
    -------
    adjacency matrix : pd.DataFrame()
        Nodes that are connected based on source and target.

    """
    adjmat = adjmat.stack().reset_index()
    adjmat.columns = ['source', 'target', 'weight']
    Iloc1 = adjmat['source'] != adjmat['target']
    Iloc2 = adjmat['weight'] > 0
    Iloc = Iloc1 & Iloc2
    adjmat = adjmat.loc[(Iloc), :]
    adjmat.reset_index(drop=True, inplace=True)
    return adjmat
