Skip to content

feat: add graphify graph3d — interactive 3D force-directed HTML viewer#2170

Open
DDBCDVD wants to merge 1 commit into
Graphify-Labs:v8from
DDBCDVD:feat/graph3d-html
Open

feat: add graphify graph3d — interactive 3D force-directed HTML viewer#2170
DDBCDVD wants to merge 1 commit into
Graphify-Labs:v8from
DDBCDVD:feat/graph3d-html

Conversation

@DDBCDVD

@DDBCDVD DDBCDVD commented Jul 24, 2026

Copy link
Copy Markdown

What

Adds graphify graph3d: a self-contained, interactive 3D force-directed HTML view of graph.json, as a WebGL counterpart to graphify tree.

The flat graph.html (vis-network) lays the graph out undirected with no arrowheads, so edge direction — the thing that distinguishes calls / imports / inherits — isn't visible. graph3d renders 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 v4 branch, 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 one elif in the CLI dispatch, mirroring the existing tree command exactly. Happy to close this in favor of a rebased #225 if its author revives it. (See also #577.)

How

  • graphify/graph3d_html.pybuild_graph3d_data() + write_graph3d_html(). 3d-force-graph (MIT) is loaded from a CDN, the same way tree_html loads D3 from d3js.org; graph data is embedded inline so the file opens over file:// without a CORS shim.
  • New graph3d subcommand in cli.py, mirroring tree (--graph / --output / --label), sharing exporters.base.COMMUNITY_COLORS and the existing graph-size cap (_enforce_graph_size_cap_or_exit + check_graph_file_size_cap).
  • Node labels are HTML-escaped at render time (JS 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

graphify graph3d [--graph PATH] [--output HTML] [--label NAME]
# default output: graphify-out/GRAPH_3D.html

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. ruff clean; the 3 tests pass.


🤖 Generated with Claude Code

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
DDBCDVD force-pushed the feat/graph3d-html branch from aec5278 to 87342a1 Compare July 24, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant