magnetic_laplacian_matrix#
- magnetic_laplacian_matrix(G, *, nodelist=None, normalized=False, q=0.25, weight='weight')[source]#
Returns the magnetic Laplacian matrix of DiGraph G.
The magnetic Laplacian matrix (also called the q-magnetic Laplacian) is a Hermitian matrix for directed graphs that encodes edge directionality via complex phases [1].
Given a weighted directed graph, \(G = (V, E, W)\), with \(W\) the weighted adjacency matrix, the symmetrized weighted adjacency matrix is defined as \(W' = 0.5 (W + W^{T})\). A skew-symmetric term \(\delta\) is introduced to encode directionality, where
- ..math::
- delta_{jk} = begin{cases}
+1 & text{if} j to k text{ is an edge and } k to j text{ is not}, \ -1 & text{if} k to j text{ is an edge and } j to k text{ is not}, \ 0 & text{if both or neither edge is present.} end{cases}
Then, the magnetic Laplacian matrix is defined as:
\[L^{(q)} := D - H^{(q)}\]where \(H^{(q)}\) is the Hermitian adjacency matrix with entries \(H^{(q)}_{jk} = W'_{jk} e^{2\pi i q \delta_{jk}}\), and \(D\) is the degree matrix associated with the symmetrized weight adjacency matrix \(W'\).
If
normalizedis True, compute the normalized version using the Moore-Penrose inverse \(D^{+}}\) of the degree matrix \(D\). The normalized formula is then:\[L^{(q)}_{norm} = (D^{+})^{0.5} L^{(q)} (D^{+})^{0.5}\]- Parameters:
- GDiGraph
A directed graph
- nodelistlist, optional (default=list(G))
Node ordering for row/columns.
- normalizedbool, optional (default=False)
Bool that encodes if return the magnetic Laplacian or the normalized magnetic Laplacian. If True returns the normalized version.
- qfloat, optional (default=0.25)
The phase of the magnetic potential is the charge parameter 0 <= q <= 0.5. At q=0 returns the standard Laplacian.
- weightstring or None, optional (default=’weight’)
Edge attribute key for weights. If None, all edges have weight 1.
- Returns:
- LSciPy sparse array (complex dtype)
The magnetic Laplacian matrix of
Gif notnormalizedand the normalized version ifnormalized
- Raises:
- ValueError
If q is not between 0 and 0.5
- NetworkXNotImplemented
If
Gis undirected or a multigraph
References
[1]Fanuel, M., Alaíz, C. M., Fernández, Á., & Suykens, J. A. (2018). Magnetic eigenmaps for the visualization of directed graphs. Applied and Computational Harmonic Analysis, 44(1), 189–199. <https://doi.org/10.1016/j.acha.2017.01.004>