library(igraph)
V1 <- c("A", "A","B","C","D","E")
V2 <- c("A", "B","C","D","E","A")
graph.with.self.loops <- graph_from_data_frame(data.frame(V1, V2), directed=FALSE)
dup.graph <- dup.nodes.from.graph(graph.with.self.loops)
print(incident(dup.graph,"A"))
Run the code above in your browser using DataLab