Determining topology formed in a Graph
Given a graph containing n edges. The task is to find the topology formed by the given set of edges in that graph.Examples:Input: edges = Output: “linear”Explanation: This test case contains three edges that are connected end-to-end, forming a linear topology.Input: edges = Output: “star”Explanation: This test case contains four edges that are all connected to a central node (1), forming a star topology.Input: edges = Output: “ring”Explanation: This test case contains five edges that are connected in a circular fashion,…