def rel_to_matrix(Rel): ## Creates a matrix where the rows, columns are indexed by elements of A, and entry encodes if (a,b) is in R or not. A = Rel[