Every matrix corresponds to a graph.…