Repository: ManimCommunity/manim
File: manim/mobject/graph.py (Python)

Code before:
            self,
            *args,
            graph: GenericGraph,
            vertex_mobjects: Iterable,
            **kwargs,
        ):
            super().__init__(*args, introducer=True, **kwargs)
            self._vertex_mobjects = vertex_mobjects
            self._graph = graph

        def finish(self):
            super().finish()
            for v in self._vertex_mobjects:
                self.buffer.remove(v[-1])
                vertex = self._graph._add_created_vertex(*v)
                self.buffer.add(vertex)
            self.apply_buffer = True

    @override_animate(add_vertices)
    def _add_vertices_animation(self, *args, anim_args=None, **kwargs):
        if anim_args is None:
            anim_args = {}

        animation = anim_args.pop("animation", Create)

        vertex_mobjects = self._create_vertices(*args, **kwargs)

        return self._AddVerticesAnimation(
            *(animation(v[-1], **anim_args) for v in vertex_mobjects),
            group=self,
            graph=self,
            vertex_mobjects=vertex_mobjects,
        )

    def _remove_vertex(self, vertex):
        """Remove a vertex (as well as all incident edges) from the graph.

        Parameters
        ----------

        vertex
            The identifier of a vertex to be removed.

        Returns
        -------

        Group
            A mobject containing all removed objects.

        """
        if vertex not in self.vertices:

Review comment (suggestion):
I forgot to include it in the review, but I believe that a name like `vertex_args_list` better reflects the content of this variable and the `_AddVerticesAnimation` parameter/attribute. They're not a list of Mobjects, but rather a list of tuples containing the arguments which will be passed into `._add_created_vertex()`:
```suggestion
        vertex_args_list = self._create_vertices(*args, **kwargs)
```

Code after:
        self,
        *vertices: Hashable,
        anim_args: dict[str, Any] | None = None,
        **kwargs: Any,
    ) -> AnimationGroup:
        vertex_mobjects = self.add_vertices(*vertices, **kwargs)

        base_anim_args = {"animation": Create, "introducer": False}
        if anim_args is not None:
            base_anim_args.update(anim_args)
        animation = base_anim_args.pop("animation")

        return AnimationGroup(
            animation(vertex_mobject, **base_anim_args)
            for vertex_mobject in vertex_mobjects
        )

    def _remove_vertex(self, vertex):
        """Remove a vertex (as well as all incident edges) from the graph.

        Parameters
        ----------

        vertex
            The identifier of a vertex to be removed.

        Returns
        -------

        Group
            A mobject containing all removed objects.

        """
        if vertex not in self.vertices:
            raise ValueError(
                f"The graph does not contain a vertex with identifier '{vertex}'",
            )

        self._graph.remove_node(vertex)
        self._layout.pop(vertex)
        if vertex in self._labels:
            self._labels.pop(vertex)
        self._vertex_config.pop(vertex)

        edge_tuples = [e for e in self.edges if vertex in e]
        for e in edge_tuples:
            self._edge_config.pop(e)
        to_remove = [self.edges.pop(e) for e in edge_tuples]
        to_remove.append(self.vertices.pop(vertex))

        self.remove(*to_remove)