v <- c(0, 0, 1, 1, 0,
0, 0, 0, 0, 0,
-1, 0, 0, 1, 0)
a <- matrix(v, 3, 5)
colnames(a) <- LETTERS[1:5]
rownames(a) <- LETTERS[1:3]
nGlobal <- list(color="#dedeff")
nProp <- data.frame(shape=c('triangle', 'lozenge'))
rownames(nProp) <- c('C', 'E')
ndf <-getNodesDataFrame(A=a, nGlobal=nGlobal, nProp=nProp)
eGlobal <- list(color="#5555ff")
eProp <- data.frame(from=c('A','C'), to=c('B', 'A'), width=c(2,2))
edf <- getEdgesDataFrame(A=a, eGlobal=eGlobal, eProp=eProp)
graph2json(ndf=ndf, edf=edf)
Run the code above in your browser using DataLab