code: def addRouter(self, name=None):
          '''
          Add a new switch to the topology.
          '''
          if name is None:
              while True:
                  name = 'r' + str(self.__rnum)
                  self.__rnum += 1
                  if name not in self.__nxgraph:
                      break
          self.__addNode(name, Router)
          return namf addRouter(self, name=None):
          '''
          Add a new switch to the topology.
          '''
          if name is None:
              while True:
                  name = 'r' + str(self.__rnum)
                  self.__rnum += 1
                  if name not in self.__nxgraph:
                      break
          self.__addNode(name, Router)
          return name
docs: Add a new switch to the topology.