I want lmd algorithm in r that described as:
Given a graph G, V is the set of nodes, suppose the node v has the largest degree, v is a local maximal-degree node, because the degrees of the nodes in v’s neighbors set is smaller or equal to v’s degree. Put v into the local maximal degree nodes set H and remove v and its neighbors with degree smaller than v from V. In the remaining nodes in V, if the node with the largest degree is a local maximal degree node, remove the node and its neighbors whose degree is smaller than the local maximal degree node. If the nodes with the largest degree is not a local maximal degree node, remove it from V. Repeat the process, until all local maximal nodes are found and not any node is left in V. We should not compare every node and its neighbor to determine whether it is a local maximal degree node. We do not to analyze the nodes which are in the local maximal degree node’s neighbor set and have smaller degree. The worst time complexity is O(dn) to finding all the local maximal degree nodes, where n is the number of nodes in network and d is the average degree of nodes.
i write this code in r:
library(igraph)
seedselection <-function(graph){
vecount<-vcount(graph)
for (i in 1:vecount) {
j<-max(degree(graph))
seed <-j
delete.vertices(graph, j)
delete.vertices(graph,neighbors(graph, j))
}
seeds <- list(seed)
print(seeds)
}
but result of this code is false?