Rendering: colour scale, greyscale, legends and edge sampling differ from the C++ LaNet-vi
- Dominant language
- Python
- Stars
- 8
- Forks
- 0
- Avg merge
- 6h 10m
- Merged PRs (30d)
- 16
Description
Found by the September 2026 comparison against the C++ sources (see docs/migration-from-cpp.md on branch docs/legacy-heritage (PR #17)). Extends #10.
- Colour stops (`visualization/colors.py`): C++ `types.cpp` runs magenta(0.01) → blue(0.20) → cyan(0.35) → green(0.50) → yellow(0.65) → red(0.97), so the maximum core is red. Python runs blue → cyan → green → yellow → orange → red(0.83) → magenta(1.0): maximum core magenta. Classic LaNet-vi figures are not reproduced.
- Greyscale is inverted: C++ light → black at the maximum core; Python black → white. `bwi` uses a separate stop list where the C++ reused the same scale.
- Luminosity alternation 0.7/1.2 in C++ vs 0.7/1.0 in Python; k-dense rules (alternate only on black, `+2` on the colour-scale maximum for m-cores, labels as k-2) not applied.
- Colour legend: title hardcoded "k-core" (#10), `edgecolor="black"` invisible on the default black background, drawn even when `--colors-file` is given (C++ hid it), 13 samples instead of one per shell.
- Size legend (`_draw_size_legend`) uses different formulas from the node sizes in `core/network.py` and ignores `node_size_scale`, so it does not describe the drawn nodes. Node size itself switches from a log law to a linear law at 1000 nodes.
- Edge sampling: C++ was a per-edge Bernoulli with p = max(edges, minedges/E); Python uses a shell-stratified quota topped up with the highest-shell edges and the unseeded `random` module, so `--seed` does not make images reproducible.
- Edge colour/width: fixed 0.75 darkening for every scheme (C++ 0.75 for col, 1.2 for bw/bwi; k-dense colours edges by their own dense index), linear width instead of the C++ degree-radius width, weights ignored.
- `bbox_inches="tight"` means the PNG is not W×H; the aspect-ratio validator rejects legitimate sizes such as 3200×800.
- Node borders: C++ border = node colour; Python none by default, and the scatter path (>1000 nodes) uses alpha 0.9 while patches are opaque.
Contributor guide
Research direction
Start with docs/migration-from-cpp.md, visualization/colors.py, and core/network.py, then compare the Python rendering paths against the referenced C++ sources. Review the legend helpers, edge sampling, node sizing, borders, and PNG validation described in the issue. Done means the listed rendering behavior matches C++ and seeded output and size validation remain correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100