Discussion:
[igraph] Question about difference command
Tomas Olivier
2017-09-18 20:33:26 UTC
Permalink
Hi,

I have a list of 60+ igraph objects. Although they are different networks
(some with more vertices and edges than others), they all share a core set
of vertices and edges. I would like to subtract that core set of vertices
and edges from the 60+ networks in my list, ideally through some sort of
loop.

So far I've tried this (the 42nd graph in my original list "graph_list" has
only the core structure that I want to remove from all graphs in my list).
I would like generate a new list (reduced_graph_list) including graph
objects that have only the vertices and edges that are unique to each
graph, and this doesn't seem to be doing the trick. Do you have any
suggestions?

reduced_graph_list = lapply(graph_list,function(x) difference(x,
graph_list[[42]]))

Thank you!

Tomas

Loading...