mphowardlab / mphowardlab/relentless
Refactor variable graph to use weak references
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Right now, the VariableGraph uses the Variable objects as nodes. I think this means that networkx holds a reference to the object, and so Variables can never be garbage collected. This could lead to very large graphs if someone did a lot of operations on Variables, e.g., in a loop or something.
We should change the way the graph works so that it uses the ID of the variable as the node name, then hold a weakref to the object keyed on the ID. Any DependentVariables should hold references to their dependencies internally to keep them alive. When we evaluate on the graph, we can add a garbage collection step that prunes out dead variables before traversal.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating VariableGraph and its evaluation or traversal entry point, then inspect how Variable and DependentVariable objects are retained. Confirm how graph nodes and dependencies are currently represented. Done means graph nodes use variable IDs, objects are weakly referenced, dependent variables retain their dependencies, and dead variables are pruned before traversal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100