Skip to main content
deleted 2 characters in body
Source Link
Jitse
  • 7.7k
  • 3
  • 19
  • 43

Python 3, 7068 bytes

f=lambda g:len({*sum(g,())})==2*len<2*len(g)and g or max(f(g-{k})for k in g)or g

Try it online!Try it online!

Takes input as set. Recursively removes one item until there are no duplicate vertices. It then returns the set with the most items.

Python 3, 70 bytes

f=lambda g:len({*sum(g,())})==2*len(g)and g or max(f(g-{k})for k in g)

Try it online!

Takes input as set. Recursively removes one item until there are no duplicate vertices. It then returns the set with the most items.

Python 3, 68 bytes

f=lambda g:len({*sum(g,())})<2*len(g)and max(f(g-{k})for k in g)or g

Try it online!

Takes input as set. Recursively removes one item until there are no duplicate vertices. It then returns the set with the most items.

deleted 16 characters in body
Source Link
Jitse
  • 7.7k
  • 3
  • 19
  • 43

Python 3, 8370 bytes

f=lambda g:len({j for i in *sum(g for j in i,())})==len==2*len(g)*2andand g or max(f(g-{k})for k in g)

Try it online!Try it online!

Takes input as set. Recursively removes one item until there are no duplicate vertices. It then returns the set with the most items.

Python 3, 83 bytes

f=lambda g:len({j for i in g for j in i})==len(g)*2and g or max(f(g-{k})for k in g)

Try it online!

Takes input as set. Recursively removes one item until there are no duplicate vertices. It then returns the set with the most items.

Python 3, 70 bytes

f=lambda g:len({*sum(g,())})==2*len(g)and g or max(f(g-{k})for k in g)

Try it online!

Takes input as set. Recursively removes one item until there are no duplicate vertices. It then returns the set with the most items.

Source Link
Jitse
  • 7.7k
  • 3
  • 19
  • 43

Python 3, 83 bytes

f=lambda g:len({j for i in g for j in i})==len(g)*2and g or max(f(g-{k})for k in g)

Try it online!

Takes input as set. Recursively removes one item until there are no duplicate vertices. It then returns the set with the most items.