embed.2011PJM: Directed Graph Embedding by Perrault-Joncas and Meila (2011)

Description Usage Arguments Value Examples

View source: R/embed.2011PJM.R

Description

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

Usage

1
embed.2011PJM(graph, ndim = 2)

Arguments

graph

an igraph object or (N\times N) affinity matrix.

ndim

an embedding dimension for a given graph.

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.

Examples

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

## embed in R^2
solution = embed.2011PJM(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
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)

kyoustat/PNAS documentation built on Nov. 14, 2019, 4:09 p.m.