Revision 1 as of 2011-11-04 05:24:45

Clear message

Network Analysis in R with igraph

A network can be described by a list of nodes, or vertices that interact with each other, thus a tab-delimited list:

Bj1     dah
Bj1     rst
Borr    CG6459
Borr    Rab11
BthD    CG6843
BthD    Mcm3

Read a table into R and generate a network graph:

data <- read.table(file="my_interactions.txt",sep="\t")

# create a graph data object
g <- graph.data.frame(data, directed=F)

# draw it
plot(g)

It can look a bit amorphous and un interpretable. Draw it with a "force-directed algorithm:

plot(g,layout=layout.fruchterman.reingold)

If your network contains un-connected pieces, you can find them using the deconstruct function.

dg <- decompose.graph(g)

This returns a list, whereby each element is itself a graph data object.