def graph_from_matrix(matrix):    
    """ Create a graph from an adjacency matrix """
    rows = range(len(matrix))
    columns = range(len(matrix[0]))
            
    graph = { x : [] for x in rows }
    
    for row in rows:
        for column in columns:
            if matrix[row][column]:
                graph[row] += [column]
    
    return graph