def add_edge(self, start, end, **kwargs):
        """
        Add an edge between two nodes.

        The nodes will be automatically added if they are not present in the network.

        Parameters
        ----------
        start: tuple
               Both the start and end nodes should specify the time slice as
               (node_name, time_slice). Here, node_name can be any hashable
               python object while the time_slice is an integer value,
               which denotes the time slice that the node belongs to.

        end: tuple
               Both the start and end nodes should specify the time slice as
               (node_name, time_slice). Here, node_name can be any hashable
               python object while the time_slice is an integer value,
               which denotes the time slice that the node belongs to.

        Examples
        --------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> model = DBN()
        >>> model.add_nodes_from(['D', 'I'])
        >>> model.add_edge(('D',0), ('I',0))
        >>> model.edges()
        [(('D', 1), ('I', 1)), (('D', 0), ('I', 0))]
        """
        try:
            if len(start) != 2 or len(end) != 2:
                raise ValueError('Nodes must be of type (node, time_slice).')
            elif not isinstance(start[1], int) or not isinstance(end[1], int):
                raise ValueError('Nodes must be of type (node, time_slice).')
            elif start[1] == end[1]:
                start = (start[0], 0)
                end = (end[0], 0)
            elif start[1] == 1 - end[1]:
                start = (start[0], 0)
                end = (end[0], 1)
            elif start[1] > end[1]:
                raise NotImplementedError('Edges in backward direction are not allowed.')
            elif start[1] != end[1]:
                raise ValueError("Edges over multiple time slices is not currently supported")
        except TypeError:
            raise ValueError('Nodes must be of type (node, time_slice).')

        if start == end:
            raise ValueError('Self Loops are not allowed')
        elif start in super(DynamicBayesianNetwork, self).nodes() and end \
                in super(DynamicBayesianNetwork, self).nodes() and \
                nx.has_path(self, end, start):
            raise ValueError('Loops are not allowed. Adding the edge from ({start} --> {end}) forms a loop.'.format(
                start=str(start), end=str(end)))

        super(DynamicBayesianNetwork, self).add_edge(start, end, **kwargs)

        if start[1] == end[1]:
            super(DynamicBayesianNetwork, self).add_edge((start[0], 1 - start[1]), (end[0], 1 - end[1]))
        else:
            super(DynamicBayesianNetwork, self).add_node((end[0], 1 - end[1]))
dataset/ETHPy150Open pgmpy/pgmpy/pgmpy/models/DynamicBayesianNetwork.py/DynamicBayesianNetwork.add_edge/swapped operands of `-`