I am curious how to compute some metrics for each node.
For each node compute percentage of fraudulent connections for
direct node (directed)
direct node (undirected)
the friendship network from the node (directed)
the friendship network from the node (undirected)
in total and per relationship type.
Getting started with igraph I am not sure how to move forward to writing own graph processing functions (i.e. not only applying degree, pagerank, ...). Looking forward to some suggestions to solve this task with only one pass over the graph.
Minimal sample is here
library(igraph)
id = c("a", "b", "c", "d", "e", "f", "g")
name = c("Alice", "Bob", "Charlie", "David", "Esther", "Fanny", "Gaby")
fraud = c(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)
verticeData <- data.frame(id, name, fraud)
verticeData
src <- c("a", "b", "c", "f", "e", "e", "d", "a")
dst <- c("b", "c", "b", "c", "f", "d", "a", "e")
relationship <-c("A", "B", "B", "B", "B", "A", "A", "A")
edgeData <- data.frame(src, dst, relationship)
edgeData
g <- graph_from_data_frame(edgeData, directed = TRUE, vertices = verticeData)
plot(g, vertex.color=V(g)$fraud)
# TODO compute metrics
I do not have privileges to move, so will do manually based on comment from https://stats.stackexchange.com/questions/256859/igraph-compute-metrics-for-each-node-and-its-network