问题
Let A be the NxN adjacency matrix of an undirected unweighted network, without self-loops. Let 1 be a column vector of N elements, all equal to 1. In other words 1 = (1, 1, ..., 1)T , where the superscript T indicates the transpose operation. Use the matrix formalism (multiplicative constants, multiplication row by column, matrix operations like transpose and trace, etc, but avoid the sum symbol Σ) to write expressions for:
a)The vector k whose elements are the degrees ki of all nodes i = 1, 2,..., N.
b)The total number of edges, L, in the network.
d)The number of triangles T present in the network, where a triangle means three nodes, each connected by links to the other two (Hint: you can use the trace of a matrix).
回答1:
a) multiply the adjacency matrix with the 1 (vector you mentioned) b) use (1, 1, …, 1) * (vector from a)T, which gives you the sum of all elements in the adjacency matrix, that is the number of all edges. c) There exists a theorem. Let A be an adjacency matrix, then A^k[i][j] gives you the number of paths, of length k from node i to node j. If you then calculate A^3 and look at the diagonal elements (i), those give you the number of paths from node i to itself of length 3, which are so called triangles. If you then account for all permutations, the answer is sum(trace(A^3)) / 6.
来源:https://stackoverflow.com/questions/58002627/matrix-formalism-nxn-adjacency-matrix