Description Usage Arguments Value References Examples
View source: R/embedding_embed2011PJM.R
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.
1 | embed2011PJM(graph, ndim = 2)
|
graph |
one of the followings; (1) an |
ndim |
an embedding dimension for a given graph (default: 2). |
a named list containing
an (N\times ndim) matrix of embedded coordinates.
an (N\times ndim) matrix of directional information on each one.
perrault-joncas_directed_2011T4network
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.