====== Dual hypernet ====== > hyper.dual <- function(HN){ + HD <- HN + HD$info$creator <- c(HN$info$creator,"hyper.dual") + HD$info$date <- c(HN$info$date,date()) + HD$info$nNodes <- HN$info$nLinks; m <- HD$info$nLinks <- HN$info$nNodes + HD$nodes <- subset(HN$links,select=-c(E)); HD$links <- HN$nodes + E = vector(mode="list",m) + for(i in 1:m) E[[i]] <- which(sapply(HN$links$E,function(x) i %in% x)) + HD$links$E <- E + return(HD) + } > HN$info$title [1] "Network file formats and tools" > str(HN) List of 5 $ format: chr "hypernets" $ info :List of 9 ..$ network: chr "NetFormats" ..$ title : chr "Network file formats and tools" ..$ by : chr "Gao etal." ..$ href : chr [1:2] "https://www.cell.com/patterns/pdf/S2666-3899(23)00218-0.pdf" "https://github.com/bavla/symData/tree/master/SDAJSON" ..$ creator: chr "V. Batagelj" ..$ date : chr "Sun Nov 12 15:52:36 2023" ..$ nNodes : int 7 ..$ nLinks : int 8 ..$ simple : logi NA $ nodes :'data.frame': 7 obs. of 1 variable: ..$ ID: chr [1:7] "EasyGraph" "NetworkX" "igraph" "SNAP" ... $ links :'data.frame': 8 obs. of 2 variables: ..$ ID: chr [1:8] "Edge List" "GraphML" "GML" "Pickle" ... ..$ E :List of 8 .. ..$ : int [1:5] 1 2 3 4 6 .. ..$ : int [1:6] 1 2 3 5 6 7 .. ..$ : int [1:6] 1 2 3 5 6 7 .. ..$ : int [1:4] 1 2 3 5 .. ..$ : int [1:4] 1 2 3 6 .. ..$ : int [1:5] 1 3 4 5 6 .. ..$ : int [1:2] 1 6 .. ..$ : int [1:2] 1 6 $ data : list() > HD <- hyper.dual(HN) > str(HD) List of 5 $ format: chr "hypernets" $ info :List of 9 ..$ network: chr "NetFormats" ..$ title : chr "Network file formats and tools" ..$ by : chr "Gao etal." ..$ href : chr [1:2] "https://www.cell.com/patterns/pdf/S2666-3899(23)00218-0.pdf" "https://github.com/bavla/symData/tree/master/SDAJSON" ..$ creator: chr [1:2] "V. Batagelj" "hyper.dual" ..$ date : chr [1:2] "Sun Nov 12 15:52:36 2023" "Mon Nov 13 01:27:24 2023" ..$ nNodes : int 8 ..$ nLinks : int 7 ..$ simple : logi NA $ nodes :'data.frame': 8 obs. of 1 variable: ..$ ID: chr [1:8] "Edge List" "GraphML" "GML" "Pickle" ... $ links :'data.frame': 7 obs. of 2 variables: ..$ ID: chr [1:7] "EasyGraph" "NetworkX" "igraph" "SNAP" ... ..$ E :List of 7 .. ..$ : int [1:8] 1 2 3 4 5 6 7 8 .. ..$ : int [1:5] 1 2 3 4 5 .. ..$ : int [1:6] 1 2 3 4 5 6 .. ..$ : int [1:2] 1 6 .. ..$ : int [1:4] 2 3 4 6 .. ..$ : int [1:7] 1 2 3 5 6 7 8 .. ..$ : int [1:2] 2 3 $ data : list()