embed2011PJM: Directed Graph Embedding by Perrault-Joncas and Meila (2011)

Description Usage Arguments Value References Examples

View source: R/embedding_embed2011PJM.R

Description

Find a low-dimensional embedding of the network given an asymmetric/directed graph using some information from Laplacian-type operators. For simplicity, this function only accepts a network of \lbrace 0, 1 \rbrace binary edges.

Usage

1
embed2011PJM(graph, ndim = 2)

Arguments

graph

one of the followings; (1) an igraph object, (2) a network object, or (3) an (N\times N) adjacency matrix.

ndim

an embedding dimension for a given graph (default: 2).

Value

a named list containing

embed

an (N\times ndim) matrix of embedded coordinates.

field

an (N\times ndim) matrix of directional information on each one.

References

\insertRef

perrault-joncas_directed_2011T4network

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## create a simple directed ring graph
library(igraph)
mygraph = graph.ring(10, directed=TRUE)

## embed in R^2
solution = embed2011PJM(mygraph)
coords = solution$embed
fields = solution$field

## extract coordinates information
x0 = coords[,1]; y0 = coords[,2]
x1 = x0 + fields[,1]
y1 = y0 + fields[,2]

## visualize the results
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2), pty="s")
plot(mygraph, main="directed ring graph")
plot(x0,y0, pch=19, main="embedded in R^2",xlim=c(-0.5,0.5),ylim=c(-0.5,0.5))
text(x0+0.05,y0+0.05,labels=1:10)
arrows(x0,y0,x1,y1,length=0.1)
par(opar)

kisungyou/T4network documentation built on Dec. 21, 2021, 6:44 a.m.