Created
April 1, 2015 12:30
-
-
Save dashalom/1481eb7d8cced8ecb5c6 to your computer and use it in GitHub Desktop.
Plotting Networks using igraph package in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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