Graph theory is a branch of mathematics that deals with the study of graphs, which…