TreeNode, ListNode, and GraphNode render as diagrams in Jupyter and clean ASCII in the terminal.
The data structure classes from leetcode_py convert between LeetCode’s
array format and live objects, and render themselves so you can look at
what your code is doing.
from leetcode_py import GraphNode, ListNode, TreeNode
Cyclic lists are safe: traversal detects cycles instead of hanging, in both
directions.Each class carries a few extras beyond conversion and rendering:
TreeNode.find_node(value) returns the first node with that value.
GraphNode.is_clone(other) checks deep equality between a graph and its
copy, the shape clone-graph problems ask for.
All three are generic: TreeNode[int], ListNode[str], and so on.
from leetcode_py.data_structures import DictTree gives a dict-backed
tree that renders with box-drawing characters in the terminal and Graphviz
in Jupyter, which suits Trie implementations.
As the last expression of a cell, these objects render as Graphviz SVG
diagrams. TreeNode lays out top-to-bottom; ListNode goes left-to-right
with rounded boxes. A cyclic list draws the back-edge in red, dashed, and
labeled cycle.
head = ListNode.from_list([1, 2, 3])head.next.next.next = head.next # cycle: 3 -> 2head # renders the diagram, cycle included
print() falls back to clean text: an indented tree, an arrow chain for
lists (cycles shown as ... (cycle back to 2)), and a formatted adjacency
dict for graphs.
Diagram rendering needs the system Graphviz binary (see
Installation). If it is missing, the
objects fall back to the ASCII form, so you get readable output either way.
Last modified on August 24, 2026
{"docsConfig":{"theme":"mint","$schema":"https://www.mintlify.com/docs.json","name":"leetcode-py","description":"Modern Python LeetCode practice environment with automated problem generation, beautiful data structure visualizations, and comprehensive testing","colors":{"primary":"#3776AB","light":"#5A94C4","dark":"#387EB8"},"logo":{"light":"https://mintcdn.com/leetcode-py/aJKJ4BOUnXP-zM3G/img/brand/leetcode-py-lockup.svg?fit=max\u0026auto=format\u0026n=aJKJ4BOUnXP-zM3G\u0026q=85\u0026s=34c74a404ed256642a54345a92489c97","dark":"https://mintcdn.com/leetcode-py/aJKJ4BOUnXP-zM3G/img/brand/leetcode-py-lockup-dark.svg?fit=max\u0026auto=format\u0026n=aJKJ4BOUnXP-zM3G\u0026q=85\u0026s=263c5757fbf5e547de96291651e279e9"},"favicon":"https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/favicon.svg?fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=3b1dffe162e80798a504a810fcbeba45","background":{"color":{"light":"#F8F9FB","dark":"#0D1117"}},"navbar":{"links":[{"href":"https://github.com/wislertt/leetcode-py","label":"GitHub"}]},"footer":{"socials":{"github":"https://github.com/wislertt/leetcode-py"},"links":[{"header":"Resources","items":[{"label":"PyPI","href":"https://pypi.org/project/leetcode-py-sdk"},{"label":"Why leetcode-py","href":"/getting-started/why-leetcode-py"},{"label":"Made by Wisaroot Lertthaweedech","href":"https://wisl.dev"}]}]},"seo":{"metatags":{"canonical":"https://leetcode-py.wisl.dev","og:image":"https://leetcode-py.wisl.dev/img/brand/og-card-light.png","twitter:card":"summary_large_image"},"organization":{"url":"https://leetcode-py.wisl.dev","sameAs":["https://github.com/wislertt/leetcode-py","https://pypi.org/project/leetcode-py-sdk/","https://wisl.dev"]},"indexing":"all"},"styling":{"codeblocks":{"theme":{"light":"github-light","dark":"github-dark"}},"latex":true},"metadata":{"timestamp":true},"markdown":{"instructions":["leetcode-py is a Python LeetCode practice environment generator with one CLI: lcpy. It is not a service or platform.","Each problem is a directory under leetcode/ with README.md, solution.py, test_solution.py, helpers.py, and playground.ipynb. lcpy gen creates them from JSON templates bundled with the package.","Examples are backed by tests; copy them verbatim."]},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"leetcode-py","hasAudioNarration":false,"actualSubdomain":"leetcode-py","customDomains":["leetcode-py.wisl.dev"],"gitSource":{"type":"github","owner":"wislertt","repo":"leetcode-py","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6aeadd835fa1f5f231996c95","clientVersion":"0.0.4094","searchFilterCounts":[{"language":"default","tag":"Catalog","count":13},{"language":"default","tag":"Practice","count":5},{"language":"default","tag":"Troubleshooting","count":5},{"language":"default","tag":"Getting Started","count":3},{"language":"default","tag":"CLI","count":2},{"language":"default","tag":"Contributing","count":2},{"language":"default","tag":"Welcome","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":".sd-catalog-table th:first-child,.sd-catalog-table td:first-child{min-width:0;width:3rem}html.dark .sd-hero-light{display:none}html:not(.dark) .sd-hero-dark{display:none}.sd-badges{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-start;margin:0 0 16px;padding:0}.sd-badges a,.sd-badges a:hover,.sd-badges a:visited{display:inline-flex;flex:0 0 auto;line-height:0;height:auto!important;max-height:24px;padding:0!important;margin:0!important;text-decoration:none!important;border-bottom:none!important;background:none!important;background-image:none!important}.sd-badges img{height:20px;width:auto;max-width:none;display:block;margin:0!important}.sd-preview{border:1px solid #387eb8;border-radius:10px}"}],"page":{"pagePath":"practice/visualizations","slug":"/practice/visualizations","pageMetadata":{"title":"Visualizations","description":"TreeNode, ListNode, and GraphNode render as diagrams in Jupyter and clean ASCII in the terminal.","href":"/practice/visualizations"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"TreeNode, ListNode, and GraphNode render as diagrams in Jupyter and clean ASCII in the terminal.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedImage}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The data structure classes from `,_jsx(_components.code,{children:`leetcode_py`}),` convert between LeetCode’s\narray format and live objects, and render themselves so you can look at\nwhat your code is doing.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`from`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` leetcode_py `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`import`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` GraphNode, ListNode, TreeNode`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`array-format-live-objects`,children:`Array format, live objects`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`root `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` TreeNode.from_list([`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`3`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`9`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`20`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`None`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`None`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`15`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`7`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`root.to_list() `}),_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# [3, 9, 20, None, None, 15, 7]`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`head `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` ListNode.from_list([`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`2`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`3`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`head.to_list() `}),_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# [1, 2, 3]`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`graph `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` GraphNode.from_adjacency_list([[`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`2`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`4`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`], [`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`3`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`], [`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`2`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`4`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`], [`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`3`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`]])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`GraphNode.to_adjacency_list(graph) `}),_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# [[2, 4], [1, 3], [2, 4], [1, 3]]`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Cyclic lists are safe: traversal detects cycles instead of hanging, in both\ndirections.`}),`\n`,_jsx(_components.p,{children:`Each class carries a few extras beyond conversion and rendering:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`TreeNode.find_node(value)`}),` returns the first node with that value.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`GraphNode.is_clone(other)`}),` checks deep equality between a graph and its\ncopy, the shape clone-graph problems ask for.`]}),`\n`,_jsxs(_components.li,{children:[`All three are generic: `,_jsx(_components.code,{children:`TreeNode[int]`}),`, `,_jsx(_components.code,{children:`ListNode[str]`}),`, and so on.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`from leetcode_py.data_structures import DictTree`}),` gives a dict-backed\ntree that renders with box-drawing characters in the terminal and Graphviz\nin Jupyter, which suits Trie implementations.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`in-jupyter-diagrams`,children:`In Jupyter: diagrams`}),`\n`,_jsxs(_components.p,{children:[`As the last expression of a cell, these objects render as Graphviz SVG\ndiagrams. `,_jsx(_components.code,{children:`TreeNode`}),` lays out top-to-bottom; `,_jsx(_components.code,{children:`ListNode`}),` goes left-to-right\nwith rounded boxes. A cyclic list draws the back-edge in red, dashed, and\nlabeled `,_jsx(_components.code,{children:`cycle`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`head `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` ListNode.from_list([`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`1`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`2`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`3`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`head.next.next.next `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` head.next `}),_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# cycle: 3 -> 2`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`head `}),_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# renders the diagram, cycle included`})]}),`\n`]})})}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-viz.png?fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=fbe45ad538379e80e6b9f31b0c217f11`,alt:`TreeNode rendered as a Graphviz tree diagram in Jupyter`,\"data-og-width\":`1222`,width:`1222`,\"data-og-height\":`738`,height:`738`,\"data-path\":`images/tree-viz.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-viz.png?w=280\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=44e7728790e06614716f81e3bb445834 280w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-viz.png?w=560\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=7260b20181f6f7391670fb8a7a9996ff 560w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-viz.png?w=840\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=0a7aa20ebc6c655f738eda3f673b9397 840w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-viz.png?w=1100\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=05a72fce47448c467134e9fbb2a94b29 1100w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-viz.png?w=1650\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=d4a534d8a6dc48f1ffad711d41aa101e 1650w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-viz.png?w=2500\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=3f49cb4a5acc67d703bb2e95189da630 2500w`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-viz.png?fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=f0d3708eef0a004d929c993980abe7c3`,alt:`ListNode rendered as a left-to-right box diagram in Jupyter`,\"data-og-width\":`2044`,width:`2044`,\"data-og-height\":`292`,height:`292`,\"data-path\":`images/linkedlist-viz.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-viz.png?w=280\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=13a91440d6fccefb30b1c653a42eda72 280w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-viz.png?w=560\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=37362b32ebce0f950ddc116032d53302 560w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-viz.png?w=840\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=92f2a3b8e76c9f5dbf56286a26a8e357 840w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-viz.png?w=1100\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=09f1b52b1eaf2472725fbc0ebe3c8a96 1100w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-viz.png?w=1650\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=61a33f6b8ffea9f840cb05df5e0dcf82 1650w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-viz.png?w=2500\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=ccb665207213c7f6d064e5021b2b1c73 2500w`}),`\n`,_jsx(Heading,{level:`2`,id:`in-the-terminal-ascii`,children:`In the terminal: ASCII`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`print()`}),` falls back to clean text: an indented tree, an arrow chain for\nlists (cycles shown as `,_jsx(_components.code,{children:`... (cycle back to 2)`}),`), and a formatted adjacency\ndict for graphs.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`print`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`(root)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# 3`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# ├── 9`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# └── 20`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# ├── 15`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# └── 7`})}),`\n`]})})}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-str-viz.png?fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=781a3a70093cf73da7b7782975e9a3f5`,alt:`TreeNode printed as an ASCII tree in the terminal`,\"data-og-width\":`432`,width:`432`,\"data-og-height\":`384`,height:`384`,\"data-path\":`images/tree-str-viz.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-str-viz.png?w=280\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=426d2a285522aa6785ff14f6ef6d2c66 280w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-str-viz.png?w=560\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=e2bf6423b7dbf33ed4a3b73757be2c51 560w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-str-viz.png?w=840\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=98e5fe3588a35e9d2e721d309b5c22ae 840w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-str-viz.png?w=1100\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=245532b38bf01b734866da5f074ad098 1100w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-str-viz.png?w=1650\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=83a8a5ecb4c42bd34f07ba2f1cd2b1c0 1650w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/tree-str-viz.png?w=2500\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=eba6cb6335292f36704c27d62c274ffb 2500w`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-str-viz.png?fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=8ec66592d7bbc55e651c40fe4ab7dbb9`,alt:`ListNode printed as an arrow chain in the terminal`,\"data-og-width\":`950`,width:`950`,\"data-og-height\":`178`,height:`178`,\"data-path\":`images/linkedlist-str-viz.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-str-viz.png?w=280\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=44584faab94122b76514dcefb6b95147 280w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-str-viz.png?w=560\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=a5562ee42043d3621910726f610573e7 560w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-str-viz.png?w=840\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=71b53755f0110431ceac4f88b440c7d3 840w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-str-viz.png?w=1100\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=2978119cedaa342a8439e5db95d5589d 1100w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-str-viz.png?w=1650\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=f5ca895f73b141572e0909bc9080a838 1650w, https://mintcdn.com/leetcode-py/VCrzlUI648LnF7Pk/images/linkedlist-str-viz.png?w=2500\u0026fit=max\u0026auto=format\u0026n=VCrzlUI648LnF7Pk\u0026q=85\u0026s=8fc8721b7804012072753c5881b89832 2500w`}),`\n`,_jsx(Heading,{level:`2`,id:`requirements`,children:`Requirements`}),`\n`,_jsxs(_components.p,{children:[`Diagram rendering needs the system Graphviz binary (see\n`,_jsx(_components.a,{href:`/getting-started/installation`,children:`Installation`}),`). If it is missing, the\nobjects fall back to the ASCII form, so you get readable output either way.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":{"theme":{"light":"github-light","dark":"github-dark"}},"config":{},"pageMetadata":{"title":"Visualizations","description":"TreeNode, ListNode, and GraphNode render as diagrams in Jupyter and clean ASCII in the terminal.","href":"/practice/visualizations"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Array format, live objects","slug":"array-format-live-objects","depth":2,"children":[]},{"title":"In Jupyter: diagrams","slug":"in-jupyter-diagrams","depth":2,"children":[]},{"title":"In the terminal: ASCII","slug":"in-the-terminal-ascii","depth":2,"children":[]},{"title":"Requirements","slug":"requirements","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"leetcode-py","siteName":"leetcode-py","title":"Visualizations - leetcode-py","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-24T03:14:49.426Z","gitLastModified":"2026-08-24T03:14:26.000Z","originalFileLocation":"practice/visualizations.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"TreeNode, ListNode, and GraphNode render as diagrams in Jupyter and clean ASCII in the terminal.\">\u003cmeta data-mint-head name=\"application-name\" content=\"leetcode-py\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/leetcode-py/MPF4VdYq1xxotsp3/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/leetcode-py/MPF4VdYq1xxotsp3/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/leetcode-py/MPF4VdYq1xxotsp3/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/leetcode-py/MPF4VdYq1xxotsp3/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/leetcode-py/MPF4VdYq1xxotsp3/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/leetcode-py/MPF4VdYq1xxotsp3/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/leetcode-py/MPF4VdYq1xxotsp3/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/leetcode-py/MPF4VdYq1xxotsp3/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/leetcode-py/MPF4VdYq1xxotsp3/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Visualizations - leetcode-py\">\u003cmeta data-mint-head property=\"og:description\" content=\"TreeNode, ListNode, and GraphNode render as diagrams in Jupyter and clean ASCII in the terminal.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"leetcode-py\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://leetcode-py.wisl.dev/practice/visualizations\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://leetcode-py.wisl.dev/img/brand/og-card-light.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Visualizations - leetcode-py\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"TreeNode, ListNode, and GraphNode render as diagrams in Jupyter and clean ASCII in the terminal.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://leetcode-py.wisl.dev/img/brand/og-card-light.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/leetcode-py/MPF4VdYq1xxotsp3/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"leetcode-py\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#3776AB\">\u003clink data-mint-head rel=\"canonical\" href=\"https://leetcode-py.wisl.dev/practice/visualizations\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/practice/visualizations.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://leetcode-py.wisl.dev/#organization\",\"name\":\"leetcode-py\",\"url\":\"https://leetcode-py.wisl.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/leetcode-py/aJKJ4BOUnXP-zM3G/img/brand/leetcode-py-lockup.svg?fit=max\u0026auto=format\u0026n=aJKJ4BOUnXP-zM3G\u0026q=85\u0026s=34c74a404ed256642a54345a92489c97\"},\"sameAs\":[\"https://github.com/wislertt/leetcode-py\",\"https://pypi.org/project/leetcode-py-sdk/\",\"https://wisl.dev\"]},{\"@type\":\"WebSite\",\"@id\":\"https://leetcode-py.wisl.dev#website\",\"name\":\"leetcode-py\",\"url\":\"https://leetcode-py.wisl.dev\",\"publisher\":{\"@id\":\"https://leetcode-py.wisl.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://leetcode-py.wisl.dev/practice/visualizations#webpage\",\"url\":\"https://leetcode-py.wisl.dev/practice/visualizations\",\"name\":\"Visualizations\",\"description\":\"TreeNode, ListNode, and GraphNode render as diagrams in Jupyter and clean ASCII in the terminal.\",\"dateModified\":\"2026-08-24T03:14:26.000Z\",\"isPartOf\":{\"@id\":\"https://leetcode-py.wisl.dev#website\"},\"breadcrumb\":{\"@id\":\"https://leetcode-py.wisl.dev/practice/visualizations#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://leetcode-py.wisl.dev/practice/visualizations#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Practice\",\"item\":\"https://leetcode-py.wisl.dev/practice/problem-anatomy\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Visualizations\",\"item\":\"https://leetcode-py.wisl.dev/practice/visualizations\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://leetcode-py.wisl.dev/practice/visualizations#article\",\"headline\":\"Visualizations\",\"name\":\"Visualizations\",\"description\":\"TreeNode, ListNode, and GraphNode render as diagrams in Jupyter and clean ASCII in the terminal.\",\"url\":\"https://leetcode-py.wisl.dev/practice/visualizations\",\"mainEntityOfPage\":{\"@id\":\"https://leetcode-py.wisl.dev/practice/visualizations#webpage\"},\"image\":\"https://leetcode-py.wisl.dev/img/brand/og-card-light.png\",\"dateModified\":\"2026-08-24T03:14:26.000Z\",\"publisher\":{\"@id\":\"https://leetcode-py.wisl.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://leetcode-py.wisl.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"leetcode-py\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"leetcode-py","nav":{"global":null,"groups":[{"group":"Welcome","pages":[{"title":"LeetCode Practice Environments in Python","sidebarTitle":"leetcode-py","href":"/index"}]},{"group":"Getting Started","pages":[{"title":"Install the lcpy CLI via pip or uv","sidebarTitle":"Installation","href":"/getting-started/installation"},{"title":"lcpy Quickstart: First Problem in 5 Commands","sidebarTitle":"Quickstart","href":"/getting-started/quickstart"},{"title":"LeetCode Practice Environment vs a Bare Editor","sidebarTitle":"Why leetcode-py","href":"/getting-started/why-leetcode-py"}]},{"group":"Practice","pages":[{"title":"Anatomy of a problem","href":"/practice/problem-anatomy"},{"title":"Test LeetCode Solutions Locally with pytest","sidebarTitle":"Test locally","href":"/practice/test-locally"},{"title":"LeetCode Python Test Cases with pytest","sidebarTitle":"Testing","description":"Anatomy of a generated LeetCode test suite: 10+ parametrized pytest cases per problem, logged output, and one suite covering multiple solutions.","href":"/practice/testing"},{"title":"Visualizations","href":"/practice/visualizations"},{"title":"Notebooks","description":"Every problem ships a playground in jupytext percent format, plain Python in git and a notebook when you want one.","href":"/practice/notebooks"}]},{"group":"CLI","pages":[{"title":"lcpy CLI: Generate and List Problems","sidebarTitle":"lcpy","href":"/cli/lcpy"},{"title":"Blind 75, Grind 75, NeetCode and Others","sidebarTitle":"Collections","href":"/cli/collections"}]},{"group":"Catalog","pages":[{"title":"LeetCode Problem Catalog: All Collections","sidebarTitle":"Catalog","href":"/catalog/index"},{"title":"All LeetCode Problems in Python with Tests","sidebarTitle":"All Problems","href":"/catalog/all"},{"title":"Easy LeetCode Problems in Python with Tests","sidebarTitle":"Easy","href":"/catalog/easy"},{"title":"Medium LeetCode Problems in Python with Tests","sidebarTitle":"Medium","href":"/catalog/medium"},{"title":"Hard LeetCode Problems in Python with Tests","sidebarTitle":"Hard","href":"/catalog/hard"},{"title":"Topics","href":"/catalog/topics"},{"title":"Grind 75 in Python with Tested Solutions","sidebarTitle":"Grind 75","href":"/catalog/grind-75"},{"title":"Grind Collection in Python: Tested Solutions","sidebarTitle":"Grind","href":"/catalog/grind"},{"title":"Blind 75 in Python with Tested Solutions","sidebarTitle":"Blind 75","href":"/catalog/blind-75"},{"title":"NeetCode 150 in Python with Tested Solutions","sidebarTitle":"NeetCode 150","href":"/catalog/neetcode-150"},{"title":"NeetCode 250 in Python with Tested Solutions","sidebarTitle":"NeetCode 250","href":"/catalog/neetcode-250"},{"title":"NeetCode All in Python with Tested Solutions","sidebarTitle":"NeetCode All","href":"/catalog/neetcode"},{"title":"AlgoMaster 75 in Python with Tested Solutions","sidebarTitle":"AlgoMaster 75","href":"/catalog/algo-master-75"}]},{"group":"Contributing","pages":[{"title":"Add a New LeetCode Problem End to End","sidebarTitle":"Problem creation","href":"/contributing/problem-creation"},{"title":"Contributor Reference: bakefile Tasks","sidebarTitle":"bakefile","href":"/contributing/bakefile"}]},{"group":"Troubleshooting","pages":[{"title":"lcpy Errors and Troubleshooting","sidebarTitle":"Troubleshooting","href":"/troubleshooting/index"},{"title":"lcpy gen Error: Problem Not Found","sidebarTitle":"Problem not found","href":"/troubleshooting/unknown-problem"},{"title":"lcpy gen Error: Problem Already Exists","sidebarTitle":"Already exists","href":"/troubleshooting/files-already-exist"},{"title":"Visualizations Show ASCII Instead of Diagrams","sidebarTitle":"ASCII diagrams","href":"/troubleshooting/graphviz-missing"},{"title":"Playground Notebook Cells Do Not Render","sidebarTitle":"Notebook cells","href":"/troubleshooting/notebook-cells"}]}]},"basePath":"","title":"Visualizations - leetcode-py","buildId":"dpl_42LwxxU1kGN114H4XzwGYXa9ZDah","deploymentId":"dpl_42LwxxU1kGN114H4XzwGYXa9ZDah","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-DkE6VzSN.js","lightbox-handle-r17bVUz3.js"]}