make_laplacian {graphsim}R Documentation

Generate Laplacian Matrix

Description

Compute the Laplacian matrix of a (directed) igraph structure, preserving node/column/row names (and direction).

Usage

make_laplacian_adjmat(mat, directed = FALSE)

make_laplacian_graph(graph, directed = FALSE)

Arguments

mat

precomputed adjacency matrix.

directed

logical. Whether directed information is passed to the Laplacian matrix.

graph

An igraph object. May be directed or weighted.

Value

An Laplacian matrix compatible with generating an expression matrix

Author(s)

Tom Kelly tom.kelly@riken.jp

See Also

See also generate_expression for computing the simulated data, make_sigma for computing the Sigma (\Sigma) matrix, make_distance for computing distance from a graph object, make_state for resolving inhibiting states.

See also plot_directed for plotting graphs or heatmap.2 for plotting matrices.

See also make_commonlink or make_adjmatrix for computing input matrices.

See also igraph for handling graph objects.

Other graphsim functions: generate_expression(), make_adjmatrix, make_commonlink, make_distance, make_sigma, make_state, plot_directed()

Other graph conversion functions: make_adjmatrix, make_commonlink

Examples


# construct a synthetic graph module
library("igraph") 
graph_test_edges <- rbind(c("A", "B"), c("B", "C"), c("B", "D"))
graph_test <- graph.edgelist(graph_test_edges, directed = TRUE)
# compute Laplacian matrix for toy example
laplacian_matrix <- make_laplacian_graph(graph_test)
laplacian_matrix

# compute Laplacian matrix from adjacency matrix
adjacency_matrix <- make_adjmatrix_graph(graph_test)
laplacian_matrix <- make_laplacian_adjmat(adjacency_matrix)
laplacian_matrix

# construct a synthetic graph network
graph_structure_edges <- rbind(c("A", "C"), c("B", "C"), c("C", "D"), c("D", "E"),
                               c("D", "F"), c("F", "G"), c("F", "I"), c("H", "I"))
graph_structure <- graph.edgelist(graph_structure_edges, directed = TRUE)
# compute Laplacian matrix for toy network
graph_structure_laplacian_matrix <- make_laplacian_graph(graph_structure)
graph_structure_laplacian_matrix
 
# import graph from package for reactome pathway
# TGF-\eqn{\Beta} receptor signaling activates SMADs (R-HSA-2173789)
TGFBeta_Smad_graph <- identity(TGFBeta_Smad_graph)

# compute Laplacian matrix for TGF-\eqn{\Beta} receptor signaling activates SMADs
TGFBeta_Smad_laplacian_matrix <- make_laplacian_graph(TGFBeta_Smad_graph)
dim(TGFBeta_Smad_laplacian_matrix)
TGFBeta_Smad_laplacian_matrix[1:12, 1:12]
# visualise matrix
library("gplots")
heatmap.2(TGFBeta_Smad_laplacian_matrix, scale = "none", trace = "none",
          col = colorpanel(50, "blue", "white", "red"))


[Package graphsim version 1.0.3 Index]