I've the following dataset:
**Strenght Movie1 Movie2** 23 2 3 80 1 2 10 4 3
And I want to create a graph with the relationships between movies having the first column as the strenght of the relationship. How can I do this using R?
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.Sign up to join this community
Try this R code:
library(igraph) dfr <- data.frame(idMovie1=c(2,1,4), idMovie2=c(3, 2, 3), strength=c(23,80,10)) igr <- igraph::graph.data.frame(dfr) plot(x = igr, edge.curved=FALSE, edge.width=log(edge_attr(igr)$strength), edge.label=edge_attr(igr)$strength, main="Graph of Movie Strengths")
Works only for small daasets. visualizations get ugly quickly.