feat: add graphify graph3d — interactive 3D force-directed HTML viewer#2170
Open
DDBCDVD wants to merge 1 commit into
Open
feat: add graphify graph3d — interactive 3D force-directed HTML viewer#2170DDBCDVD wants to merge 1 commit into
graphify graph3d — interactive 3D force-directed HTML viewer#2170DDBCDVD wants to merge 1 commit into
Conversation
Adds a WebGL counterpart to `graphify tree`. Where the flat graph.html (vis-network) lays the graph out undirected with no arrowheads, graph3d renders it as a rotatable 3D force graph and draws edge direction (source -> target) as arrows, so calls/imports/inherits read directionally. - new graphify/graph3d_html.py: build_graph3d_data + write_graph3d_html; 3d-force-graph (MIT) loaded from CDN like tree_html loads D3; data embedded inline (opens over file://); node labels HTML-escaped at render time - new `graph3d` subcommand in cli.py mirroring `tree` (--graph/--output/--label) - shares COMMUNITY_COLORS and the graph-size cap with the existing exporters - tests/test_graph3d_html.py: data shaping, XSS escaping, CLI end-to-end A minimal, focused alternative to the stalled Graphify-Labs#225 (which spread the feature across 42 files against the older v4 branch). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
DDBCDVD
force-pushed
the
feat/graph3d-html
branch
from
July 24, 2026 23:17
aec5278 to
87342a1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
graphify graph3d: a self-contained, interactive 3D force-directed HTML view ofgraph.json, as a WebGL counterpart tographify tree.The flat
graph.html(vis-network) lays the graph out undirected with no arrowheads, so edge direction — the thing that distinguishescalls/imports/inherits— isn't visible.graph3drenders the graph in 3D (rotatable) and draws the direction as arrows (source → target). Click a node to focus it and list its typed relations, search by label, and the community colors match the rest of the tool.Why a new command instead of #225
#225 already proposes 3D, but it's stalled (last activity in April, targets the old
v4branch, currently unmergeable /dirty) and spreads the feature across 42 files / +7.1k lines. This is a deliberately minimal alternative — 5 files, +316 lines: one new module plus oneelifin the CLI dispatch, mirroring the existingtreecommand exactly. Happy to close this in favor of a rebased #225 if its author revives it. (See also #577.)How
graphify/graph3d_html.py—build_graph3d_data()+write_graph3d_html().3d-force-graph(MIT) is loaded from a CDN, the same waytree_htmlloads D3 fromd3js.org; graph data is embedded inline so the file opens overfile://without a CORS shim.graph3dsubcommand incli.py, mirroringtree(--graph/--output/--label), sharingexporters.base.COMMUNITY_COLORSand the existing graph-size cap (_enforce_graph_size_cap_or_exit+check_graph_file_size_cap).esc()), and the embedded JSON is</-escaped, so a hostile node label can't break out of the<script>block or inject markup into the local report.Usage
Tests
tests/test_graph3d_html.py— data shaping (dangling-link drop, community-label mapping, degree), the XSS-escaping guarantee, and the CLI end-to-end.ruffclean; the 3 tests pass.🤖 Generated with Claude Code