What I need to do is to add a new vertex to a graph and find two edges to add to it in order to get a (very) big betweenness for it. What I tried to do is to create 1 edge to a very central node and the iterate through all the other nodes and try to get the max betweenness for this new node. The problem is that R igraph is taking forever to complete (I don't know if it will ever finish).
Any thoughts?
This is my code:
add.vertices(graph = g, nv = 1)
newId <- max(V(g))
add.edges(graph = g,c(newId,755))
biggestBetNew <- 0
bestNodeToAdd <- 0
for(i in 1:max(V(g))){
add.edges(graph = g,c(newId,i))
newBet <- betweenness(graph = g, v = V(g)[newId], normalized = T)
if(newBet > biggestBetNew){
biggestBetNew <- newBet
bestNodeToAdd <- i
}
delete.edges(graph = g, c(newId,i))
}