class DirectedGraph:
    def __init__(self, dict = None):
        if dict is None:
            self.graphDict = {}
        else:
            self.graphDict = dict

    def addVertices(self, v):
        if v not in self.graphDict.keys():
            self.graphDict[v] = {}

    def getVerticesList(self):
        return list(self.graphDict.keys())

    def addEdge(self, e1,e2):
        if e1 in self.graphDict.keys():
            self.graphDict[e1].append(e2)
        else:
            self.graphDict[e1] = [e2]

    def getOutgoingEdges(self, v):
        if v in self.graphDict.keys():
            return self.graphDict[v]
        return None

    def getAllOutgoingEdges(self):
        edges = []
        for v in self.graphDict.keys():
            for n in self.graphDict[v]:
                if (v, n) not in edges:
                    edges.append((v,n))
        return edges


# g = { "a" : ["d"],
#           "b" : ["c"],
#           "c" : ["b", "c", "d", "e"],
#           "d" : ["a", "c"],
#           "e" : ["c"],
#           "f" : []
# }

g = {"a": ["b", "c"],
         "b": ["d"],
         "c": ["d"],
         "d": ["b"],
        }

# graph = DirectedGraph(g)
# print(graph.getOutgoingEdges('a'))
# print(graph.getAllOutgoingEdges())

d3dd32fb9298cf56361d0367a85036fdfb5588d6
class DirectedGraph:

    def __init__(self, dict=None):
        if dict is None:
            self.graphDict = {}
        else:
            self.graphDict = dict
    <mask token>
    <mask token>

    def addEdge(self, e1, e2):
        if e1 in self.graphDict.keys():
            self.graphDict[e1].append(e2)
        else:
            self.graphDict[e1] = [e2]

    def getOutgoingEdges(self, v):
        if v in self.graphDict.keys():
            return self.graphDict[v]
        return None

    def getAllOutgoingEdges(self):
        edges = []
        for v in self.graphDict.keys():
            for n in self.graphDict[v]:
                if (v, n) not in edges:
                    edges.append((v, n))
        return edges


<mask token>

class DirectedGraph:

    def __init__(self, dict=None):
        if dict is None:
            self.graphDict = {}
        else:
            self.graphDict = dict

    def addVertices(self, v):
        if v not in self.graphDict.keys():
            self.graphDict[v] = {}
    <mask token>

    def addEdge(self, e1, e2):
        if e1 in self.graphDict.keys():
            self.graphDict[e1].append(e2)
        else:
            self.graphDict[e1] = [e2]

    def getOutgoingEdges(self, v):
        if v in self.graphDict.keys():
            return self.graphDict[v]
        return None

    def getAllOutgoingEdges(self):
        edges = []
        for v in self.graphDict.keys():
            for n in self.graphDict[v]:
                if (v, n) not in edges:
                    edges.append((v, n))
        return edges


<mask token>

class DirectedGraph:

    def __init__(self, dict=None):
        if dict is None:
            self.graphDict = {}
        else:
            self.graphDict = dict

    def addVertices(self, v):
        if v not in self.graphDict.keys():
            self.graphDict[v] = {}

    def getVerticesList(self):
        return list(self.graphDict.keys())

    def addEdge(self, e1, e2):
        if e1 in self.graphDict.keys():
            self.graphDict[e1].append(e2)
        else:
            self.graphDict[e1] = [e2]

    def getOutgoingEdges(self, v):
        if v in self.graphDict.keys():
            return self.graphDict[v]
        return None

    def getAllOutgoingEdges(self):
        edges = []
        for v in self.graphDict.keys():
            for n in self.graphDict[v]:
                if (v, n) not in edges:
                    edges.append((v, n))
        return edges


<mask token>

class DirectedGraph:

    def __init__(self, dict=None):
        if dict is None:
            self.graphDict = {}
        else:
            self.graphDict = dict

    def addVertices(self, v):
        if v not in self.graphDict.keys():
            self.graphDict[v] = {}

    def getVerticesList(self):
        return list(self.graphDict.keys())

    def addEdge(self, e1, e2):
        if e1 in self.graphDict.keys():
            self.graphDict[e1].append(e2)
        else:
            self.graphDict[e1] = [e2]

    def getOutgoingEdges(self, v):
        if v in self.graphDict.keys():
            return self.graphDict[v]
        return None

    def getAllOutgoingEdges(self):
        edges = []
        for v in self.graphDict.keys():
            for n in self.graphDict[v]:
                if (v, n) not in edges:
                    edges.append((v, n))
        return edges


g = {'a': ['b', 'c'], 'b': ['d'], 'c': ['d'], 'd': ['b']}

class DirectedGraph:
    def __init__(self, dict = None):
        if dict is None:
            self.graphDict = {}
        else:
            self.graphDict = dict

    def addVertices(self, v):
        if v not in self.graphDict.keys():
            self.graphDict[v] = {}

    def getVerticesList(self):
        return list(self.graphDict.keys())

    def addEdge(self, e1,e2):
        if e1 in self.graphDict.keys():
            self.graphDict[e1].append(e2)
        else:
            self.graphDict[e1] = [e2]

    def getOutgoingEdges(self, v):
        if v in self.graphDict.keys():
            return self.graphDict[v]
        return None

    def getAllOutgoingEdges(self):
        edges = []
        for v in self.graphDict.keys():
            for n in self.graphDict[v]:
                if (v, n) not in edges:
                    edges.append((v,n))
        return edges


# g = { "a" : ["d"],
#           "b" : ["c"],
#           "c" : ["b", "c", "d", "e"],
#           "d" : ["a", "c"],
#           "e" : ["c"],
#           "f" : []
# }

g = {"a": ["b", "c"],
         "b": ["d"],
         "c": ["d"],
         "d": ["b"],
        }

# graph = DirectedGraph(g)
# print(graph.getOutgoingEdges('a'))
# print(graph.getAllOutgoingEdges())
