MunchLab / MunchLab/ceREEBerus

: MapperGraph.add_edge triggers exponential redundant mapperify() rescans via recursive re-entry

Open
#113 0 comments 0 reactions 1 assignee View on GitHub

@ishikaghosh2201 is already working on this.

Since Sep 19, 2026.

Dominant language
Jupyter Notebook
Stars
5
Forks
2
PR merge metrics
No merged PRs in 30d

Description

MapperGraph.add_edge calls self.mapperify() unconditionally on every edge added:

def add_edge(self, u, v, reset_pos=True): super().add_edge(u, v, reset_pos) self.mapperify()

mapperify() scans every integer level between the graph's min and max function value and, for every edge crossing a level, calls self.subdivide_edge(...) to insert a subdivision vertex there:

def mapperify(self): ... for i in range(n_low, n_high + 1): e_list = [e for e in self.edges() if self.f[e[0]] < i and self.f[e[1]] > i] for e in e_list: w_name = self._get_next_mapperify_vert_name() self.subdivide_edge(*e, w_name, i)

subdivide_edge (defined on the parent ReebGraph class) internally calls self.add_edge(u, w) and self.add_edge(w, v) to reconnect the new subdivision vertex. Because self is a MapperGraph instance, these calls dispatch back through the overridden MapperGraph.add_edge — which calls self.mapperify() again, re-scanning the entire graph from scratch for every single subdivision vertex inserted. Each nested mapperify() call can itself trigger more subdivisions, each of which recurses again.

This means adding a handful of edges to a modest mapper graph triggers an explosive amount of redundant, repeated whole-graph scanning. A single edge spanning 5 integer levels triggers 11 total mapperify() calls (should need 1).

The problem is demostrated in the notebook and a fix is suggested.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.