Question: ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! USE MATLAB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(Graph Stats) Note: This question is used for course assessment. As such, you are
highly encouraged to follow the instructions carefully and fully comment your code.
During assessment, identifying student data is removed, so this process is anonymized.
As discussed earlier this semester, connections in a (simple undirected) graph can be
represented through an adjacency matrix. Often, we wish to allow graphs to have
directed (one-way) edges instead of undirected (two-way) ones. In this context, we
place a 1 in location ai,j if there is an edge from node i to node j. Given a node,
we then define its in-degree as the number of edges terminating at the node and the
out-degree as the number of edges leaving the node. We also often allow edges to
start from and terminate at the same node; these edges are called loops (and will be
represented in the adjacency matrix by a 1 in a diagonal entry). For example, the
following adjacency matrix represents the connections in the depicted graph
In this problem, you will write a function that takes in the adjacency matrix of a
(simple) directed graph and will compute the total number of edges, the in- and out-
degrees of all nodes, and a list of all nodes which have loops. Be sure to use for loops
and running computations to determine these quantities.
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! USE MATLAB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(Graph Stats) Note: This question is used for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!