graphs.deep_clone_graph ======================= .. py:module:: graphs.deep_clone_graph .. autoapi-nested-parse:: LeetCode 133. Clone Graph https://leetcode.com/problems/clone-graph/ Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contains a value (int) and a list (List[Node]) of its neighbors. Classes ------- .. autoapisummary:: graphs.deep_clone_graph.Node Functions --------- .. autoapisummary:: graphs.deep_clone_graph.clone_graph Module Contents --------------- .. py:class:: Node .. py:method:: __hash__() -> int >>> hash(Node(3)) != 0 True .. py:method:: __post_init__() -> None >>> Node(3).neighbors [] .. py:attribute:: neighbors :type: list[Node] | None :value: None .. py:attribute:: value :type: int :value: 0 .. py:function:: clone_graph(node: Node | None) -> Node | None This function returns a clone of a connected undirected graph. >>> clone_graph(Node(1)) Node(value=1, neighbors=[]) >>> clone_graph(Node(1, [Node(2)])) Node(value=1, neighbors=[Node(value=2, neighbors=[])]) >>> clone_graph(None) is None True