X1595: Write method countIncoming

Description

Write a method int countIncoming(int[][] g, int a) that counts the number of edges connected to the node a as incoming edges. The graph is a directed graph, so this method should only count edges going into node a.

This method takes 2 parameters, a graph g and the a node. It returns the count of edges that go from another node into a (i.e. incoming). The graph is represented with an adjancency matrix. Remember the convention is for an edge to be stored in g[row][col], where row represents the source (from) and col the destination (to) of the edge.

Your Answer:

Feedback

Your feedback will appear here when you check your answer.