Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gt

Transpose an Input Graph


Description

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.

Usage

gt(x, return.as.edgelist = FALSE)

Arguments

x

one or more graphs.

return.as.edgelist

logical; should the result be returned in sna edgelist form?

Details

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.

Value

The transposed graph(s).

Author(s)

Carter T. Butts buttsc@uci.edu

See Also

Examples

#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)

sna

Tools for Social Network Analysis

v2.6
GPL (>= 2)
Authors
Carter T. Butts [aut, cre, cph]
Initial release
2020-10-5

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.