I have a df containing 3 columns ( from, to, new_ssp
). The from and to
columns are the node
and the new_ssp
is the score/weight
column. The range of the new_ssp is from 0 to 1.
The node name is fully different in my dataset like (IDxx, FID_XX), etc, When I am running the code, I am getting output which containing the node names like (1,2,3,4) below one!
My dataset looks like
from to new_ssp
1 ID00104 ID09099 0.92582160
2 ID00925 _ SID13505 _ Taraxerol DB00104 0.07857143
My code
graph_datset <- df
graph_build <- graph_from_data_frame(graph_datset, directed = FALSE)
E(graph_build)$weight <- graph_datset$new_ssp
plot(graph_build, vertex.label = V(graph_build)$name)
# Calculating New link prediction using 'linkprediction'
proxfun(graph_build, method="cos", value="matrix")
Generated output look likes
1 2 3
1 0 0.000000 0.000000
2 0 0.000000 1.442695
3 0 1.442695 0.000000
Now the problem is
- Is it possible to get the output node names from the dataset instead of 1/2/3? Because, this is very difficult for me to match my input node name and output node name!
- I have found, when I am using only 2 columns
from and to
I am getting the same output at the time of 3 columnsfrom, to, and score/weight
. Is it possible to use weight and take this weight to calculate the link prediction? Because, the weight must have some significance to predict the new link.