Adjacency matrix of the directed graph.
adjacency.matrix(edges, labels = FALSE, required.groups = c(0))
edges | an edge list |
---|---|
labels | add row and column labels |
required.groups | which edge groups should be included? |
Returns the adjacency matrix for the directed graph.
This function converts an edge list to an adjacency matrix
A
, following the convention that A[i,j]
represents
the impact of node j
on node i
.
edges <- parse.digraph(c( "E *-> D", "D *-> C", "C -> E", "E *-> B", "B *-> A", "A -> E", "D -> B")) edges <- enforce.limitation(edges) adjacency.matrix(edges,labels=TRUE)#> A B C D E #> A -1 1 0 0 0 #> B -1 -1 0 1 1 #> C 0 0 -1 1 0 #> D 0 0 -1 -1 1 #> E 1 -1 1 -1 -1