# NOT RUN {
# convertion from gRapHD to graphNEL
edges <- matrix(c(1,2,1,3,1,4),,2,byrow=TRUE)
g <- as(edges,"gRapHD")
#List of 9
# $ edges : num [1:3, 1:2] 1 1 1 2 3 4
# $ p : int 4
# $ stat.user: chr "LR"
# $ statSeq : num [1:3] NA NA NA
# $ varType : int [1:4] 0 0 0 0
# $ numCat : int [1:4] 0 0 0 0
# $ homog : logi TRUE
# $ numP : num [1:3] NA NA NA
# $ userDef : num [1:2] 1 3
# - attr(*, "class")= chr "gRapHD"
g1 <- as(g,"graphNEL")
# A graphNEL graph with undirected edges
# Number of Nodes = 4
# Number of Edges = 3
g1@nodes # the nodes names
as(matrix(integer(0),,2),"gRapHD")
# note that the vertices must be numbered consecutively from 1. In the
# following, vertex 2 is added as an isolated vertex.
m1 <- as(matrix(c(1,3,1,4),,2,byrow=TRUE),"gRapHD")
# }
# NOT RUN {
plot(m1)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab