Description Usage Arguments Value Examples
View source: R/embed.2011PJM.R
Directed Graph Embedding by Perrault-Joncas and Meila (2011)
1 | embed.2011PJM(graph, ndim = 2)
|
graph |
an |
ndim |
an embedding dimension for a given graph. |
a named list containing
an (N\times ndim) matrix of embedded coordinates.
an (N\times ndim) matrix of directional information on each one.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.