This function returns the adjacency matrix of the given graph G. The (i,j)^{th} position of the matrix is 1 if there is an edge between the i^{th} vertex and j^{th} vertex, and 0 otherwise. The rows and columns are indexed by the variables of the ring and use the ordering of the variables for determining the order of the rows and columns.
i1 : S = QQ[a..f]; |
i2 : G = graph {a*b,a*c,b*c,c*d,d*e,e*f,f*a,a*d} o2 = Graph{edges => {{a, b}, {a, c}, {b, c}, {a, d}, {c, d}, {d, e}, {a, f}, {e, f}}} ring => S vertices => {a, b, c, d, e, f} o2 : Graph |
i3 : t = adjacencyMatrix G o3 = | 0 1 1 1 0 1 | | 1 0 1 0 0 0 | | 1 1 0 1 0 0 | | 1 0 1 0 1 0 | | 0 0 0 1 0 1 | | 1 0 0 0 1 0 | 6 6 o3 : Matrix ZZ <--- ZZ |
i4 : T = QQ[f,e,d,c,b,a]; |
i5 : G = graph {a*b,a*c,b*c,c*d,d*e,e*f,f*a,a*d} o5 = Graph{edges => {{f, e}, {e, d}, {d, c}, {c, b}, {f, a}, {d, a}, {c, a}, {b, a}}} ring => T vertices => {f, e, d, c, b, a} o5 : Graph |
i6 : t = adjacencyMatrix G -- although the same graph, matrix is different since variables have different ordering o6 = | 0 1 0 0 0 1 | | 1 0 1 0 0 0 | | 0 1 0 1 0 1 | | 0 0 1 0 1 1 | | 0 0 0 1 0 1 | | 1 0 1 1 1 0 | 6 6 o6 : Matrix ZZ <--- ZZ |
The object adjacencyMatrix is a method function.