graspologic icon indicating copy to clipboard operation
graspologic copied to clipboard

[REFACTOR]: Consider cleaning up utils.import_edgelist

Open daxpryce opened this issue 4 years ago • 1 comments

Any time your return type can be:

def import_edgelist(
    path: Union[str, Path, Iterable[str, Path]],
    extension: str = "edgelist",
    delimiter: Optional[str] = None,
    nodetype: Callable[[Any], Any] = int,
    return_vertices: bool = False
) -> Union[
    np.ndarray,
    List[np.ndarray],
    Tuple[
        Union[np.ndarray, List[np.ndarray]],
        np.ndarray
    ]
]:

you should consider refactoring into more than one method or function. I suggest this one be broken into:

  • import_edgelist
  • import_edgelist_set

Only in the latter case should you return vertices, and in the latter case you should always return vertices.

This utility should also go into an io package.

daxpryce avatar Apr 01 '21 23:04 daxpryce

Hey @daxpryce , I would like to work on this issue :)

chiraag-kakar avatar Sep 27 '21 18:09 chiraag-kakar