Skip to content

Possible bug in the prediction method #28

Open
@mostafiz67

Description

@mostafiz67

I am not sure, I am wrong or what wrong with the package. But something is wrong. For example, when I am trying to calculate the link prediction score for common neighbor it is showing score 1 for node 1 and 8 but the dataset does not have any common neighbor between these 2 nodes. Again, it is not showing any score for node 1 and 6 but we have 1 common neighbor between these 2 nodes.

Code:

df_graph <- read.csv("~/Assignment_3.csv", header = TRUE)
graph <- graph_from_data_frame(df_graph, directed = FALSE)
plot(graph, vertex.label = V(graph)$name)
Common_neighbor <- linkprediction::proxfun(graph, method= "cn", value = "edgelist")

Output

   from to value
1     2  1     2
2     3  1     1
3     4  1     1
4     8  1     1
5     1  2     2
6     3  2     1
7     6  2     1
8     8  2     2
9     1  3     1
10    2  3     1
11    4  3     1
12    7  3     1
13    8  3     1
14    1  4     1
15    3  4     1
16    5  4     2
17    6  4     1
18    7  4     2
19    4  5     2
20    6  5     1
21    7  5     1
22    8  5     1
23    2  6     1
24    4  6     1
25    5  6     1
26    8  6     1
27    3  7     1
28    4  7     2
29    5  7     1
30    1  8     1
31    2  8     2
32    3  8     1
33    5  8     1
34    6  8     1

Reproducible Data:

structure(list(To = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 4L, 5L, 8L, 
8L), From = c(7L, 3L, 4L, 7L, 4L, 5L, 4L, 6L, 6L, 5L, 6L)), class = "data.frame", row.names = c(NA, 
-11L))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions