# dataSet = read csv(Test csv)library(igraph) library(

Content type
User Generated
Rating
Showing Page:
1/6
library(\"igraph\")
library(\"plyr\")
##### Similarity
gD <- simplify(graph.data.frame(dataSet,
directed=FALSE))
plot(gD)
degAll <- degree(gD, v = V(gD), mode = \"all\")
# Calculate betweenness for all nodes
betAll <- betweenness(gD, v = V(gD), directed = FALSE) /
(((vcount(gD) - 1) * (vcount(gD)-2)) / 2)
betAll.norm <- (betAll - min(betAll))/(max(betAll) -
min(betAll))
rm(betAll)
# Calculate Dice similarities between all pairs of nodes
dsAll <- similarity.dice(gD, vids = V(gD), mode = \"all\")
This is producing a graph in which everything on the graph
is nodes.
For Example, my input data was:
![dataset](http://i.imgur.com/JtwXPsQ.png?1)
And my end goal is to create node size/betweenness to
show similarity between recipes and similarity between
users but as of right now it is doing a combination of both.
I wanted two separate graphs, one similarity graph by ID
one similarity graph by Recipe.
![graph](http://i.imgur.com/6d1swp6.png?1)

Showing Page:
2/6
Solution
rm(list = ls())
library(\"igraph\")
library(\"plyr\")
\"\\t\")
# Create a graph. Use simplify to ensure that there are no
duplicated edges or self-loops
gD <- simplify(graph.data.frame(dataSet,
directed=FALSE))
# Print number of nodes and edges
# vcount(gD)
# ecount(gD)
# Calculate some node properties and node similarities
that will be used to illustrate
# different plotting abilities
# Calculate degree for all nodes
degAll <- degree(gD, v = V(gD), mode = \"all\")

Showing Page:
3/6

End of Preview - Want to read all 6 pages?
Access Now
Unformatted Attachment Preview
dataSet = read.csv(\"Test.csv\") library(\"igraph\") library(\"plyr\") ##### Similarity gD ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

### Review

Anonymous
I use Studypool every time I need help studying, and it never disappoints.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4