Learn R Programming

graphlayouts (version 0.2.0)

layout_igraph_eigen: spectral graph layouts

Description

Using a set of eigenvectors of matrices associated with a graph as coordinates

Usage

layout_igraph_eigen(g, type = "laplacian", ev = "smallest", circular)

layout_with_eigen(g, type = "laplacian", ev = "smallest")

Arguments

g

igraph object

type

matrix to be used for spectral decomposition. either 'adjacency' or 'laplacian'

ev

eigenvectors to be used. Either 'smallest' or 'largest'.

circular

not used

Value

coordinates to be used layouting a graph

Details

the layout_igraph_* function should not be used directly. It is only used as an argument for 'ggraph'.

Examples

Run this code
# NOT RUN {
library(igraph)
library(ggraph)

g <- sample_gnp(50,0.2)

ggraph(g,layout="eigen",type="adjacency",ev="largest")+
  geom_edge_link(n=2,edge_colour="grey66")+
  geom_node_point(shape=21,fill="grey25",size=5)+
  theme_graph()

ggraph(g,layout="eigen",type="adjacency",ev="smallest")+
  geom_edge_link(n=2,edge_colour="grey66")+
  geom_node_point(shape=21,fill="grey25",size=5)+
  theme_graph()


ggraph(g,layout="eigen",type="laplacian",ev="largest")+
  geom_edge_link(n=2,edge_colour="grey66")+
  geom_node_point(shape=21,fill="grey25",size=5)+
  theme_graph()

ggraph(g,layout="eigen",type="laplacian",ev="smallest")+
  geom_edge_link(n=2,edge_colour="grey66")+
  geom_node_point(shape=21,fill="grey25",size=5)+
  theme_graph()
# }

Run the code above in your browser using DataLab