# Matrices and Vector Spaces Associated with a Graph or Digraph

## `AdjacencyMatrix(G): Grph -> AlgMatElt`

Returns the adjacency matrix for the $(p, q)$ graph $G$ as an element of the matrix ring $M_p(Z)$.

## `DistanceMatrix(G): Grph -> AlgMatElt`

Returns the distance matrix $A$ for the $(p, q)$ graph $G$ as an element of the matrix ring $M_p(Z)$. The $(i, j)$-th entry of $A$ gives the distance between vertices $v_i$ and $v_j$ of $G$.

## `IncidenceMatrix(G): Grph -> ModHomElt`

Returns the incidence matrix $M$ for the $(p, q)$ graph $G$ as an element of the matrix bimodule $M^{p \times q}(Z)$.

If $G$ is a graph, then entry $(i, j)$ of M is $1$ if the vertex $v_i$ of $G$ lies on the edge $e_j$ of $G$. Otherwise entry $(i, j)$ is zero.

If $G$ is a digraph, entry $(i, j)$ of M is $1$ if vertex $v_i$ is the initial vertex of the edge $e_j$, and $-1$ if $v_i$ is the final vertex of the edge $e_j$. Otherwise entry $(i, j)$ is zero. If $e_j$ is a loop, then entry $(i, j)$ may be either $1$ or $-1$.

## `IntersectionMatrix(G, P): GrphUnd, { { GrphVert}} -> AlgMatElt`

## `IntersectionMatrix(G, P): GrphUnd, { { RngIntElt}} -> AlgMatElt`

Given an ordered equitable partition $P = P_1 \cup P_2 \cup \ldots \cup P_r$ of the vertex-set of the graph $G$, return the intersection matrix $T$ for the partition. Thus, entry $T[i, j]$ is the number of vertices of the set $P_j$ that are adjacent to a vertex of the set $P_i$.
