daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. graph = Graph.new
  2.  
  3. kevin_bacon = Node.new('Kevin Bacon')
  4. james_mcavoy = Node.new('James McAvoy')
  5. michael_fassbender = Node.new('Michael Fassbender')
  6. jennifer_lawrence = Node.new('Jennifer Lawrence')
  7. steve_carell = Node.new('Steve Carell')
  8. ryan_gosling = Node.new('Ryan Gosling')
  9. emma_stone = Node.new('Emma Stone')
  10. morgan_freeman = Node.new('Morgan Freeman')
  11. chris_pratt = Node.new('Chris Pratt')
  12. harrison_ford = Node.new('Harrison Ford')
  13. tommy_lee_jones = Node.new('Tommy Lee Jones')
  14. zoe_saldana = Node.new('Zoe Saldana')
  15. bradley_cooper = Node.new('Bradley Cooper')
  16. chris_pine = Node.new('Chris Pine')
  17. simon_pegg = Node.new('Simon Pegg')
  18. tom_cruise = Node.new('Tom Cruise')
  19. jeremy_renner = Node.new('Jeremy Renner')
  20. amy_adams = Node.new('Amy Adams')
  21.  
  22. kevin_bacon.film_actor_hash['X-Men: First Class'] = [james_mcavoy, michael_fassbender, jennifer_lawrence]
  23. james_mcavoy.film_actor_hash['X-Men: First Class'] = [kevin_bacon, michael_fassbender, jennifer_lawrence]
  24. michael_fassbender.film_actor_hash['X-Men: First Class'] = [james_mcavoy, kevin_bacon, jennifer_lawrence]
  25. jennifer_lawrence.film_actor_hash['X-Men: First Class'] = [james_mcavoy, michael_fassbender, kevin_bacon]
  26.  
  27. james_mcavoy.film_actor_hash['Wanted'] = [morgan_freeman, chris_pratt]
  28. morgan_freeman.film_actor_hash['Wanted'] = [james_mcavoy, chris_pratt]
  29. chris_pratt.film_actor_hash['Wanted'] = [morgan_freeman, james_mcavoy]
  30.  
  31. harrison_ford.film_actor_hash['The Fugitive'] = [tommy_lee_jones]
  32. tommy_lee_jones.film_actor_hash['The Fugitive'] = [harrison_ford]
  33.  
  34. ryan_gosling.film_actor_hash['Blade Runner: 2049'] = [harrison_ford]
  35. harrison_ford.film_actor_hash['Blade Runner: 2049'] =[ryan_gosling]
  36.  
  37. kevin_bacon.film_actor_hash['Crazy, Stupid, Love'] = [ryan_gosling, emma_stone]
  38. ryan_gosling.film_actor_hash['Crazy, Stupid, Love'] = [kevin_bacon, emma_stone]
  39. emma_stone.film_actor_hash['Crazy, Stupid, Love'] = [ryan_gosling, kevin_bacon]
  40.  
  41. chris_pratt.film_actor_hash['Guardians of the Galaxy'] = [zoe_saldana, bradley_cooper]
  42. zoe_saldana.film_actor_hash['Guardians of the Galaxy'] = [chris_pratt, bradley_cooper]
  43. bradley_cooper.film_actor_hash['Guardians of the Galaxy'] = [zoe_saldana, chris_pratt]
  44.  
  45. simon_pegg.film_actor_hash['Mission Impossible: Ghost Protocol'] = [tom_cruise, jeremy_renner]
  46. tom_cruise.film_actor_hash['Mission Impossible: Ghost Protocol'] = [simon_pegg, jeremy_renner]
  47. jeremy_renner.film_actor_hash['Mission Impossible: Ghost Protocol'] = [simon_pegg, tom_cruise]
  48.  
  49. zoe_saldana.film_actor_hash['Star Trek: Into Darkness'] = [chris_pine, simon_pegg]
  50. chris_pine.film_actor_hash['Star Trek: Into Darkness'] = [zoe_saldana, simon_pegg]
  51. simon_pegg.film_actor_hash['Star Trek: Into Darkness'] = [chris_pine, zoe_saldana]
  52.  
  53. jeremy_renner.film_actor_hash['Arrival'] = [amy_adams]
  54. amy_adams.film_actor_hash['Arrival'] = [jeremy_renner]
  55.    
  56.  
  57. # print graph.find_kevin_bacon(michael_fassbender) #expect ['X-Men: First Class']
  58. # print graph.find_kevin_bacon(morgan_freeman) #expect ['Wanted','X-Men: First Class']
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top