Walmart interview question

Implement code to compute the average value of nodes in a graph.