R: How to convert CSV data to igraph object

37 views Asked by At

I'm going to analyse (some exploratory analysis and I'm new to this subject) large networks in R. So I have a FLICKR data set in hand.

FLICKR DATA

If you see the data set, it consists of 4 different CSV file with different attribute of a graph or network. How to convert this data to igraph object?

I have see the following solution in the Stack overflow.

SOL 1, SOL 2

I also know there is a function called csv.to.igraph function in the influenceR package, but unable to serve my purpose.

Any kind of help is appreciated.

1

There are 1 answers

2
Wimpel On

Your quenstion is (probably) too broad. It should focus on a single problem.

But here is a first approach, it reads the relevant csv (with edges), and creates a (directed) graph

library(data.table)
library(igraph)
edges <- data.table::fread("./data/Flickr-dataset/data/edges.csv")
g <- igraph::graph_from_data_frame(d = edges, directed = TRUE)