educative.io

Does edge between tow nodes in undirected graph count one edge or two edges?

in Sample Input, it’s 11 edges.
in Sample Output , it’s 22 edges.
in Explanation texts, in’s 11 edges,
but in Explanation pic, it’s 22 edges.

It’s so confusing!!!

From the things I googled, it’s 11 edges. every edge counts as 1 edge, which means this practice and the solution are wrong.

the correct answer in the the solution is sum/2.

Hi Frankin,

This is Arqam from Educative. Thank you very much for your valuable feedback.

You are right! Every edge counts as 1 edge in case of undirected graph. Hence sum/2.
Our team has modified the lesson. Kindly have a look and keep sharing your feedbacks with us.

Thanks and Regards,

Arqam Rehan | Developer Advocate