sharpG gnitrevnl

def inverse_graph(graph):
	n = len(graph)
	inverted_graph=[]
	for i in range(0, n):
		inverted_graph.append([])
		for j in range(0, n):
		if (i != j):
			inverted_graph[i].append(1-graph[i][j])
		else:
			inverted_graph[i].append(0)
	return inverted_graph

def test():
	g1 = [[0, 1, 1, 0],
			[1, 0, 0, 1],
			[1, 0, 0, 1],
			[0, 1, 1, 0]]
	assert inverse_graph(g1) == [[0, 0, 0, 1],
								[0, 0, 1, 0],
								[0, 1, 0, 0],
								[1, 0, 0, 0]]
	g2 = [[0, 1, 1, 1],
		[1, 0, 1, 1],
		[1, 1, 0, 1],
		[1, 1, 1, 0]]
	assert inverse_graph(g2) == [[0, 0, 0, 0],
								[0, 0, 0, 0],
								[0, 0, 0, 0],
								[0, 0, 0, 0]]