This was asked previously on stackexchange and it was suggested to bring it here where more specialists could see it.
Given the adjacency matrix $\mathbf{A}$ for a simple connected graph, the characteristic polynomial is defined as: $$ p(\lambda) = \det(\lambda \mathbf{I} - \mathbf{A})$$
Now if an edge between vertex $i$ and $j$ is specially "colored" / "marked" with another variable $x$, then we could consider a bivariate polynomial:
$$ f(\lambda,x) = \det(\lambda \mathbf{I} + x (\mathbf{e}_{ij}+\mathbf{e}_{ji}) - \mathbf{A})$$
where $\mathbf{e}_{ij}$ is the matrix with all entries zero except row $i$, column $j$, which is 1.
Or similarly, if the vertex $i$ was colored with the variable $x$, we could consider the polynomial:
$$ g(\lambda,x) = \det(\lambda \mathbf{I} + x \mathbf{e}_{ii} - \mathbf{A})$$
This of course could be extended to more colored / marked vertices or edges. If all vertices are "colored" with a different variable, the resulting "colored characteristic polynomial" completely determines the graph. I'm not sure what set of edges would need to be labelled to say the same. Currently though I'm mostly interested in graphs with a single marked edge or vertex, to try to better understand the basics of this generalization.
Has this generalization of a characteristic polynomial for graphs been studied before, and is there a name for these kinds of polynomials?
I'd also appreciate any insight one could share on what additional information this would provide about a graph ... as well as what information it wouldn't provide about a graph. For instance what special properties a graph would necessarily have if a single labelled edge could be added to a graph to form two non-isomorphic graphs, yet have the same "colored characteristic polynomial". Such as, $$\det(\lambda \mathbf{I} + x(\mathbf{e}_{ij}+\mathbf{e}_{ji}) - A) = \det(\lambda \mathbf{I} + x(\mathbf{e}_{mn}+\mathbf{e}_{nm}) - A)$$ where $mn$ and $ij$ are distinct edges.