Linear Algebra
GraphSignals.degrees — Functiondegrees(g, [T=eltype(g)]; dir=:out)Degree of each vertex. Return a vector which contains the degree of each vertex in graph g.
Arguments
g: should be a adjacency matrix,SimpleGraph,SimpleDiGraph(from Graphs) orSimpleWeightedGraph,SimpleWeightedDiGraph(from SimpleWeightedGraphs).T: result element type of degree vector; default is the element type ofg(optional).dir: direction of degree; should be:in,:out, or:both(optional).
Examples
julia> using GraphSignals
julia> m = [0 1 1; 1 0 0; 1 0 0];
julia> GraphSignals.degrees(m)
3-element Vector{Int64}:
2
1
1GraphSignals.degree_matrix — Functiondegree_matrix(g, [T=eltype(g)]; dir=:out, squared=false, inverse=false)Degree matrix of graph g. Return a matrix which contains degrees of each vertex in its diagonal. The values other than diagonal are zeros.
Arguments
g: Should be a adjacency matrix,FeaturedGraph,SimpleGraph,SimpleDiGraph(from Graphs) orSimpleWeightedGraph,SimpleWeightedDiGraph(from SimpleWeightedGraphs).T: The element type of result degree vector. The default type is the element type ofg.dir::Symbol: The way to calculate degree of a graphgregards its directions. Should be:in,:out, or:both.squared::Bool: To return a squared degree vector or not.inverse::Bool: To return a inverse degree vector or not.
Examples
julia> using GraphSignals
julia> m = [0 1 1; 1 0 0; 1 0 0];
julia> GraphSignals.degree_matrix(m)
3×3 LinearAlgebra.Diagonal{Int64, Vector{Int64}}:
2 ⋅ ⋅
⋅ 1 ⋅
⋅ ⋅ 1GraphSignals.normalized_adjacency_matrix — Functionnormalized_adjacency_matrix(g, [T=float(eltype(g))]; selfloop=false)Normalized adjacency matrix of graph g, defined as
\[D^{-\frac{1}{2}} \tilde{A} D^{-\frac{1}{2}}\]
where $D$ is degree matrix and $\tilde{A}$ is adjacency matrix w/o self loop from g.
Arguments
g: Should be a adjacency matrix,FeaturedGraph,SimpleGraph,SimpleDiGraph(from Graphs) orSimpleWeightedGraph,SimpleWeightedDiGraph(from SimpleWeightedGraphs).T: The element type of result degree vector. The default type is the element type ofg.selfloop: Adding self loop to $\tilde{A}$ or not.
Graphs.LinAlg.laplacian_matrix — Functionlaplacian_matrix(g, [T=eltype(g)]; dir=:out)Laplacian matrix of graph g, defined as
\[D - A\]
where $D$ is degree matrix and $A$ is adjacency matrix from g.
Arguments
g: Should be a adjacency matrix,FeaturedGraph,SimpleGraph,SimpleDiGraph(from Graphs) orSimpleWeightedGraph,SimpleWeightedDiGraph(from SimpleWeightedGraphs).T: The element type of result degree vector. The default type is the element type ofg.dir::Symbol: The way to calculate degree of a graphgregards its directions. Should be:in,:out, or:both.
GraphSignals.normalized_laplacian — Functionnormalized_laplacian(g, [T=float(eltype(g))]; dir=:both, selfloop=false)Normalized Laplacian matrix of graph g, defined as
\[I - D^{-\frac{1}{2}} \tilde{A} D^{-\frac{1}{2}}\]
where $D$ is degree matrix and $\tilde{A}$ is adjacency matrix w/o self loop from g.
Arguments
g: Should be a adjacency matrix,FeaturedGraph,SimpleGraph,SimpleDiGraph(from Graphs) orSimpleWeightedGraph,SimpleWeightedDiGraph(from SimpleWeightedGraphs).T: The element type of result degree vector. The default type is the element type ofg.dir::Symbol: The way to calculate degree of a graphgregards its directions. Should be:in,:out, or:both.selfloop::Bool: Adding self loop to $\tilde{A}$ or not.
GraphSignals.scaled_laplacian — Functionscaled_laplacian(g, [T=float(eltype(g))])Scaled Laplacien matrix of graph g, defined as
\[\hat{L} = \frac{2}{\lambda_{max}} \tilde{L} - I\]
where $\tilde{L}$ is the normalized Laplacian matrix.
Arguments
g: Should be a adjacency matrix,FeaturedGraph,SimpleGraph,SimpleDiGraph(from Graphs) orSimpleWeightedGraph,SimpleWeightedDiGraph(from SimpleWeightedGraphs).T: The element type of result degree vector. The default type is the element type ofg.
GraphSignals.random_walk_laplacian — Functionrandom_walk_laplacian(g, [T=float(eltype(g))]; dir=:out)Random walk normalized Laplacian matrix of graph g, defined as
\[I - D^{-1} A\]
where $D$ is degree matrix and $A$ is adjacency matrix from g.
Arguments
g: Should be a adjacency matrix,FeaturedGraph,SimpleGraph,SimpleDiGraph(from Graphs) orSimpleWeightedGraph,SimpleWeightedDiGraph(from SimpleWeightedGraphs).T: The element type of result degree vector. The default type is the element type ofg.dir::Symbol: The way to calculate degree of a graphgregards its directions. Should be:in,:out, or:both.
GraphSignals.signless_laplacian — Functionsignless_laplacian(g, [T=eltype(g)]; dir=:out)Signless Laplacian matrix of graph g, defined as
\[D + A\]
where $D$ is degree matrix and $A$ is adjacency matrix from g.
Arguments
g: Should be a adjacency matrix,FeaturedGraph,SimpleGraph,SimpleDiGraph(from Graphs) orSimpleWeightedGraph,SimpleWeightedDiGraph(from SimpleWeightedGraphs).T: The element type of result degree vector. The default type is the element type ofg.dir::Symbol: The way to calculate degree of a graphgregards its directions. Should be:in,:out, or:both.