Description Usage Arguments Value Author(s) See Also Examples
Create a graph object of class graphNEL or graphAM. You might also use the graph creating facility provided by the graph package.
1 
nodeNames 
Numeric or character string vector. 
mat 
Either an adjacency matrix or a from to matrix. 
weights 
Numeric weights for edges. Either in the same order as the from to
matrix or as a square matrix, depending what one have chosen for the

directed 
Logical value for defining a directed or undirected graph. 
isAdjacency 
If argument mat is adjacency matrix. 
... 
Currently not needed. 
graphNEL or grapAM object.
Adrian Waddell and R. Wayne Oldford
navGraph
, completegraph
, linegraph
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  ## Using from to matrices
from < c("A","A","C","C")
to < c("B","C","B","D")
ftEmat < cbind(from,to)
## note how the E node is added
G < newgraph(nodeNames = LETTERS[1:5], mat = ftEmat)
## say you would like to add weights to the graph
weights < c(2,1,3,4)
G < newgraph(nodeNames = LETTERS[1:5], mat = ftEmat, weights = weights)
## newgraph with adjacency matrix
V < c('s.L', 's.W', 'p.L', 'p.W')
adjM < matrix(c(0,1,1,0,1,0,1,1,1,1,0,0,0,1,0,0), ncol = 4)
all(adjM == t(adjM)) ## is symmetric (undirected)
G < newgraph(nodeNames = V, mat= adjM, isAdjacency=TRUE)
## if you use adjacency matrices, you can add a matrix with weights
adjM < matrix(c(0,0,1,0,1,0,1,1,0,0,0,0,0,1,0,0), ncol = 4)
weightsM < matrix(c(0,0,5,0,2,0,1,3,0,0,0,0,0,7,0,0), ncol = 4)
G < newgraph(nodeNames = V, mat= adjM, weights = weightsM, directed = TRUE, isAdjacency=TRUE)
edgeData(G, attr = "weight")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.