Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dashalom/1481eb7d8cced8ecb5c6 to your computer and use it in GitHub Desktop.
Save dashalom/1481eb7d8cced8ecb5c6 to your computer and use it in GitHub Desktop.
Plotting Networks using igraph package in R
---
title: "Week 9 HW"
author: "Dalit Shalom"
date: "March 31, 2015"
output: html_document
---
###Require packages
require(curl)
require(igraph)
###Load packages
library("curl", lib.loc="/Library/Frameworks/R.framework/Versions/3.1/Resources/library")
library("igraph", lib.loc="/Library/Frameworks/R.framework/Versions/3.1/Resources/library")
###Set vertex dataframe
vertex=data.frame(node)
###Declare the network
network=graph.data.frame(edge,directed=TRUE,vertices=vertex)
###The two layers of information we're using
ecount(network)
V(network)
###The combination of those layers
summary(network)
###Redefining network
network <- set.graph.attribute(network, "layout", layout.kamada.kawai(network))
###Plot
plot(network,vertex.shape="circle", vertex.color="red" ,vertex.size=5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment