unweightedGraph = { 
      "A" : [ "B", "G" ],
      "B" : [ "A", "C", "G" ],
      "C" : [ "B", "H" ],
      "D" : [ "F" ],
      "E" : [ "G", "H" ],
      "F" : [ "D" ],
      "G" : [ "A", "B", "E" ],
      "H" : [ "C", "E" ]
     }

weightedGraph = { 
      "A" : [ ["B", 5], ["G", 2] ],
      "B" : [ ["A", 5], ["C", 3], ["G", 2] ],
      "C" : [ ["B", 3], ["H", 9] ],
      "D" : [ ["F", 4] ],
      "E" : [ ["G", 1], ["H", 7] ],
      "F" : [ ["D", 4] ],
      "G" : [ ["A", 2], ["B", 2], ["E", 1] ],
      "H" : [ ["C", 9], ["E", 7] ]
     }

social = { "Jon" : [ "Arya", "Tyrion" ],
           "Tyrion" : [ "Jaime", "Pod", "Jon" ],
           "Arya" : [ "Jon" ],
           "Jaime" : [ "Tyrion", "Brienne" ],
           "Brienne" : [ "Jaime", "Pod" ],
           "Pod" : [ "Tyrion", "Brienne", "Jaime" ],
           "Ramsay" : [ ]
           }

def printNodes(g):
    for node in g:
        print(node)

#

def getNeighbors(g, node):
    result = []
    for neighborPair in g[node]:
        result.append(neighborPair[0])
    return result

#

def getEdges(g):
    for start in g:
        for end in g[start]:
            print(start + "-" + end)

#

def getEdgeWeight(g, start, end):
    for neighborPair in g[start]:
        if neighborPair[0] == end:
            return neighborPair[1]

#

def findMostPopular(g):
    mostFriends = -1
    mostName = None
    for person in g:
        numFriends = len(g[person])
        if numFriends > mostFriends:
            mostFriends = numFriends
            mostName = person
    return mostName

def findMostPopular(g):
    mostFriends = -1
    mostName = []
    for person in g:
        numFriends = len(g[person])
        if numFriends > mostFriends:
            mostFriends = numFriends
            mostName = [person]
        elif numFriends == mostFriends:
            mostName.append(person)
    return mostName

#

def makeInviteList(g, host):
    invite = g[host] + []
    for friend in g[host]:
        for friendOfFriend in g[friend]:
            if (friendOfFriend not in invite) and \
               (friendOfFriend != host):
                invite.append(friendOfFriend)
    return invite