A community-maintained Python framework for creating mathematical animations.
Allowed ``networkx`` to return 3D layouts when passing ``dim=3`` in the ``layout_config`` of a :class:`.Graph` (#2927)
Isaac Behc82c298cc1e0
diff --git a/manim/mobject/graph.py b/manim/mobject/graph.pyindex 2f24bbbf2..011def259 100644--- a/manim/mobject/graph.py+++ b/manim/mobject/graph.py@@ -58,7 +58,13 @@ def _determine_graph_layout(auto_layout = automatic_layouts[layout](nx_graph, scale=layout_scale, **layout_config)- return {k: np.append(v, [0]) for k, v in auto_layout.items()}+ # NetworkX returns a dictionary of 3D points if the dimension+ # is specified to be 3. Otherwise, it returns a dictionary of+ # 2D points, so adjusting is required.+ if layout_config.get("dim") == 3:+ return auto_layout+ else:+ return {k: np.append(v, [0]) for k, v in auto_layout.items()}elif layout == "tree":return _tree_layout(nx_graph, root_vertex=root_vertex, scale=layout_scale, **layout_config