
Last chance! 50% off unlimited learning
Sale ends in
get.adjacency(graph, type="both", attr=NULL, names=TRUE, binary=FALSE)
get.edgelist(graph, names=TRUE)
upper
: the upper right triangle of the matrix is used,
lower
: the lower left triangle of the matrix iNULL
or a character string giving an edge
attribute name. If NULL
a traditional adjacency matrix is
returned. If not NULL
then the values of the given edge
attribute are included in the adjacency m For graph.adjacenct
it gives whether to assign row and column names
to the matrix. These are only assigned if the name
vertex
attribute is present in the graph.
for get.edgelist
it
attr
is not NULL
.vcount(graph)
by vcount(graph)
(usually) numeric
matrix for get.adjacency
. (This can be huge!) Note that a
non-numeric matrix might be returned if attr
is a non-numeric
edge attribute. A ecount(graph)
by 2 numeric matrix for get.edgelist
.
get.adjacency
returns the adjacency matrix of a graph. get.edgelist
returns the list of edges in a graph.
graph.adjacency
, read.graph
g <- erdos.renyi.game(10, 2/10)
get.edgelist(g)
get.adjacency(g)
V(g)$name <- letters[1:vcount(g)]
get.adjacency(g)
E(g)$weight <- runif(ecount(g))
get.adjacency(g, attr="weight")
Run the code above in your browser using DataLab