gt | R Documentation |
gt
returns the graph transpose of its input. For an adjacency matrix, this is the same as using t
; however, this function is also applicable to sna edgelists (which cannot be transposed in the usual fashion). Code written using gt
instead of t
is thus guaranteed to be safe for either form of input.
gt(x, return.as.edgelist = FALSE)
x |
one or more graphs. |
return.as.edgelist |
logical; should the result be returned in sna edgelist form? |
The transpose of a (di)graph, G=(V,E)
, is the graph G=(V,E')
where E'=\{(j,i): (i,j) \in E\}
. This is simply the graph formed by reversing the sense of the edges.
The transposed graph(s).
Carter T. Butts buttsc@uci.edu
symmetrize
, t
#Create a graph....
g<-rgraph(5)
g
#Transpose it
gt(g)
gt(g)==t(g) #For adjacency matrices, same as t(g)
#Now, see both versions in edgelist form
as.edgelist.sna(g)
gt(g,return.as.edgelist=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.