# inputs
edges = [ [1,2] , [2,3] , [3,4] , [4,5] , [5,2] , [4,6] , [6,7] , [7,6] , [7,8] ]
sets = [ [2,3,4,5] , [6,7] ]
# output
sets_of_edges = [ [ [2,3] , [3,4] , [4,5] , [5,2] ] , [ [6,7] , [7,6] ] ]
How do I write a code that takes 'edges' and 'sets' and outputs 'sets_of_edges', by going through each set in 'sets' and getting the sets of edges that contain both of each value in sets (if that makes sense). I have written an example input and outputs to help explain. Thanks! :)
Here is a quick code sample that should solve your problem: