Graph union: the union of two graphs $G_1=(V_1, E_1)$ and $G_2=(V_2, E_2)$ is defined and denoted by $G_1\cup G_2=(V_1\cup V_2, E_1\cup E_2)$.
Graph intersection: the intersection of two graphs $G_1=(V_1, E_1)$ and $G_2=(V_2, E_2)$ is defined and denoted by $G_1\cap G_2=(V_1\cap V_2, E_1\cap E_2)$.
If $S$ is a set of undirected graphs, then the structure $(S, \cup, \cap)$ is a semiring, in which $(S, \cup)$ and $(S,\cap)$ are semi groups, and the operation $\cap$ distributes over the operation $\cup$.
Let $M$ be the set of adjacency matrices of all the corresponding graphs of $S$. Define $f: S\longrightarrow M$ by $f(G)=A(G)~\forall~G\in S$, where $A(G)$ is an adjacency matrix of $G$, such that $f$ is semiring homomorphism.
What operations should we define in $M$ such that it also becomes a semiring?