Create and plot a directed graph, and then compute the in-degree of every node in the graph. The in-degree of a node is equal to the number of edges with that node as the target.
s = [1 3 2 2 4 5 1 2]; t = [2 2 4 5 6 6 6 6]; G = digraph(s,t); plot(G)
Input graph, specified as adigraphobject. Usedigraphto create a directed graph object.
Example:G = digraph([1 2],[2 3])
nodeIDs—Node identifiers scalar|vector|matrix|character vector|cell array of character vectors
Node identifiers, specified as a scalar node index, a vector or matrix of numeric node indices, a character vector node name, or a cell array of character vectors containing node names. You can refer to the nodes either by their numeric node index or by their node names.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.