O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Plotting directed graphs

In step 4 of the main recipe, we created an undirected graph. Here, we create a directed graph object, dg:

> dg <- graph.data.frame(nw.new) 
> # save for later use 
> save(dg, file = "directed-graph.Rdata") 
> plot.igraph(dg,edge.curved=TRUE,edge.color="black", edge.width=E(dg)$x/10,vertex.label.cex=.6) 

On plotting the preceding graph, we get the following output:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required