dmlc / dmlc/dgl

[Refactor?] Clean up and document the utility function usages

Open
#4,481 5 comments 0 reactions 0 assignees View on GitHub
topic: Refactor
Dominant language
Python
Stars
14.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

## 🚀 Feature
(This is not really a "feature" request, but more like a code organization and refactor request)
Clean up, organize, and document all the internal utility functions DGL uses, so that people can find the appropriate utility function to do their job easily.

## Motivation
The issue is mainly for the `dgl.utils` namespace, where we have some issues that hampers readability and maintainability. I'm listing some but not all of them.

* `Index` class is largely deprecated, as it is no longer used in `dgl.heterograph` and `dgl.heterograph_index`. It still appears in some places like `dgl.partition`, `dgl.traversal` etc. which are mostly old code.
* `CtxCachedObject` is completely deprecated as it is only used in `dgl._deprecate` namespace.
* There are `build_relabel_map`, `build_relabel_dict`, `make_invmap`, and `relabel` which are all related to "relabeling non-contiguous ID arrays to contiguous ID arrays", and it's hard to identify their differences. In particular, `relabel` and `build_relabel_map` have very similar code.
* The `dgl.utils.internal` module is too bloated. There are 34 functions and 7 classes all having completely different purposes (set operations, relabeling, setting frames, recursion, etc.). We should at least group the functions and classes by their functionality, and preferably split them into smaller modules.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.