1. Design vertices of the lower case
k.
2. What is the adjacency matrix?
3. Using Python program to draw the lower case k.
4. Rotate the lower case k by 45◦counterclockwise.
5. Draw the backward lower case k.
Solved 1 Answer
See More Answers for FREE
Enhance your learning with StudyX
Receive support from our dedicated community users and experts
See up to 20 answers per week for free
Experience reliable customer service
Ans 1N = 200005n, m, =0,0vis=[0 for i in range(N)]gr=[[] for i in range(N)]v=[[] for i in range(2)]def add_edges(x, y): gr[x].append(y) gr[y].append(x)def dfs(x, state): v[state].append(x) vis[x] = 1 for i in gr[x]: if (vis[i] == 0): dfs(i, state ^ 1)def Print_vertices(): if (len(v[0]) < len(v[1])): for i in v[0]: print(i,end=" ") # If even level vertices are less else: for i in v[1]: print(i,end=" ")n = 4m = 3add_edges(1, 2)add_edges(2, 3)add_edges(3, 4)dfs(1, 0)Print_vertices()def display(n): v = n while ( v >= 0) : c = 65 for j in range(v + 1): print( chr ( c + j ), end = " ") v = v - 1 print() for i in range(n + 1): c = 65 for j in range( i + 1): print( chr ( c + j), end =" ") print()n = 5display(n)Ans 2The adjacency matrix, also called theconnection matrix, is a matrix containing rows andcolumns which is used to represent a simple labelled graph, with 0or 1 in the position of (Vi , Vj) accordingto the condition whether Vi and Vj areadjacent or not. It is a compact way to represent the finite graphcontaining n vertices of a m x m matrix M. Sometimes adjacencymatrix is also called as vertex matrix and it isdefined in the general form asIf the simple graph has no self-loops, Then the vertex matrixshould have 0s in the diagonal. It is symmetric for the undirectedgraph. The connection matrix is considered as a square array whereeach row represents the out-nodes of a graph and each columnrepresents the in-nodes of a graph. Entry 1 represents that thereis an edge between two nodes.Ans 3def display(n): v = n while ( v >= 0) : c = 65 for j in range(v + 1): print( chr ( c + j ), end = " ") v = v - 1 print() for i in range(n + 1): c = 65 for j in range( i + 1): print( chr ( c + j), end =" ") print()n = 5display(n)Ans 4import imutilstext = cv2.imread("k")Rotated_text = imutils.rotate(text, angle=45)cv2.imshow("Rotated", Rotated_text)cv2.waitKey(0)Ans 5s=input()new_str="k"for i in range (len(s)): if s[i].isupper(): new_str+=s[i].lower() elif s[i].islower(): new_str+=s[i].upper() else: new_str+=s[i]print(new_str) ...