pairs = {("Ana", "Berta"), ("Ana", "Greta"), ("Ana", "Helga"),.

Added on - 18 Sep 2019

  • 2

    Pages

  • 711

    Words

  • 97

    Views

  • 0

    Downloads

Trusted by +2 million users,
1000+ happy students everyday
Showing pages 1 to 1 of 2 pages
pairs = {("Ana", "Berta"), ("Ana", "Greta"), ("Ana", "Helga"),("Berta", "Cilka"), ("Berta", "Helga"),("Cilka", "Dani"),("Dani", "Ema"), ("Dani", "Greta"), ("Dani", "Helga"),("Ema", "Fanči"), ("Ema", "Greta"), ("Ema", "Helga"),("Fanči", "Iva"), ("Fanči", "Jana"), ("Fanči", "Klavdija"),("Greta", "Helga")}For simplicity and efficiency, every pair is listed just once, in alphabetic order (e.g. ("Ana","Berta") and not also ("Berta", "Ana").The other representation is a dictionary, where keys contain names and the correspondingvalues are sets of friends.network = {"Ana": {"Berta", "Greta", "Helga"},"Berta": {"Ana", "Helga", "Cilka"},"Cilka": {"Berta", "Dani"},"Dani": {"Cilka", "Ema", "Greta", "Helga"},"Ema": {"Dani", "Fanči", "Greta", "Helga"},"Fanči": {"Ema", "Iva", "Jana", "Klavdija"},"Greta": {"Ana", "Dani", "Ema", "Helga"},"Helga": {"Ana", "Berta", "Dani", "Ema", "Greta"},"Iva": {"Fanči"},"Jana": {"Fanči"},"Klavdija": {"Fanči"}}
desklib-logo
You’re reading a preview
Preview Documents

To View Complete Document

Click the button to download
Subscribe to our plans

Download This Document