mirror of
https://github.com/safishamsi/graphify.git
synced 2026-10-13 15:40:05 +00:00
Count an all file node community as thin, not invisible
Number 3148 fixed shown to be computed directly instead of total
minus thin, since the old formula counted a community with zero real
nodes as shown even though the render loop skips it. That fix left
thin itself under a zero real guard from before it, so a zero real
community was excluded from both figures at once and went uncounted
anywhere the report prints about itself, and shown plus thin no
longer summed to the total community count. Both counting sites drop
that guard so a community the render loop skips for having too few
real nodes, zero included, is now always reflected in the thin
figure next to it. Fixes #3548.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh
(cherry picked from commit d616c330e3)
This commit is contained in:
1 parent
c5ad8d6852
commit
3d8d4e08ee
1 file changed
+14
-7
+14
-7
@@ -161,13 +161,18 @@ def generate(
|
||||
non_empty = {cid: nodes for cid, nodes in communities.items()
|
||||
if any(not _ifn(G, n) for n in nodes)}
|
||||
# One predicate for every figure the report prints about itself (#3148):
|
||||
# "thin" is 0 < real < min_community_size, and "shown" is what the render
|
||||
# loop below actually renders (real >= min_community_size) - previously
|
||||
# shown was total-thin, which also counted communities with ZERO real
|
||||
# nodes that the loop skips, overstating the count (#2129's residual).
|
||||
# "thin" is real < min_community_size (ZERO real nodes included), and
|
||||
# "shown" is what the render loop below actually renders (real >=
|
||||
# min_community_size) - previously shown was total-thin, which also
|
||||
# counted communities with ZERO real nodes that the loop skips,
|
||||
# overstating the count (#2129's residual). A subsequent `0 <` guard on
|
||||
# "thin" fixed that overcount but introduced the opposite gap: an
|
||||
# all-file-node community (real == 0) is skipped by the SAME render loop
|
||||
# yet was excluded from "thin" too, so it went uncounted anywhere and
|
||||
# `shown + thin` silently undercounted `len(communities)` (#3548).
|
||||
thin_count_summary = sum(
|
||||
1 for nodes in communities.values()
|
||||
if 0 < _real_count(nodes) < min_community_size
|
||||
if _real_count(nodes) < min_community_size
|
||||
)
|
||||
shown_count = sum(
|
||||
1 for nodes in communities.values()
|
||||
@@ -314,10 +319,12 @@ def generate(
|
||||
# Same threshold the Summary and Communities headers used (#3148): this
|
||||
# was a hardcoded 3, so with --min-community-size anything else the count
|
||||
# here disagreed with the label text beside it, which already printed
|
||||
# min_community_size.
|
||||
# min_community_size. No `0 <` guard, matching thin_count_summary above
|
||||
# (#3548): an all-file-node community is skipped by the same render loop
|
||||
# as a genuinely thin one, so it belongs in this count too.
|
||||
thin_communities = {
|
||||
cid: nodes for cid, nodes in communities.items()
|
||||
if 0 < sum(1 for n in nodes if not _is_file_node(G, n)) < min_community_size
|
||||
if sum(1 for n in nodes if not _is_file_node(G, n)) < min_community_size
|
||||
}
|
||||
gap_count = len(isolated) + len(thin_communities)
|
||||
|
||||
|
||||
Reference in new issue
Block a user