# Please do not post homework # Lucy Martinez, 01-24-2025, Assignment 1 # Write a procedure AM(G) that inputs a graph [n,E] # and outputs the adjacency matrix, represented as a list of length of lists # of length n, such that M[i][j]=1 if {i,j} belongs to E and 0 otherwise. # For example AM([2,{{1,2}}]); should output [[0,1],[1,0]] AM:=proc(G) local L,s,i: L:=[]: for i from 1 to G[1] do L:=[op(L),[seq(0,i=1..G[1])]]: od: for s in G[2] do L[s[1],s[2]]:=1: L[s[2],s[1]]:=1: od: L: end: # Write a procedure Image(pi,G) that inputs a permutation pi of {1,...,n} # and a graph G=[n,E] and outputs the image under pi Image:=proc(pi,G) local i,s,E: E:={}: for s in G[2] do E:=E union {{pi[s[1]],pi[s[2]]}}: od: E: end: # By definition an unlabelled graph is an equivalence class of labeled graphs # under graph isomorphism (i.e. mapping under the symmetric group). # Write a procedure ULgraphs(n) that outputs a set of graphs # with ONE member of each equivalence class. # What is [seq(nops(ULgraphs(i)),i=1..6)] # Answer: 1, 2, 4, 11, 34, 156 # Is is in the OEIS? What is its A-number. # Answer: A000088 ULgraphs:=proc(n): end: