Skip to content

Align v/vids argument name? #853

Open

Description

@maelle

It was vids for the estimate_ function, it's vids for closeness(), but it's v for betweenness() and edge_betweenness().

Activity

  1. szhorvat commented on Jun 16, 2023

    @szhorvat
    Member

    This should be cleaned up. I often complain about this, e.g. #692

  2. self-assigned this
    on Nov 13, 2023
  3. maelle commented on Nov 13, 2023

    @maelle
    ContributorAuthor

    What's the final state, what should the argument names be?

  4. maelle commented on Nov 13, 2023

    @maelle
    ContributorAuthor

    related #691

  5. szhorvat commented on Nov 13, 2023

    @szhorvat
    Member

    I don't have a strong feeling about v vs vids, but currently more functions seem to use vids. We should definitely not use nodes. One argument against vids is that it seems to suggest that the input should be numerical vertex IDs, while they can be names as well.

    I collected some functions on #691, noting what parameter name they use.

    Let's keep in mind that we also have e in edge_betweenness(). If we go with vids, this should be changed to eids. If we go with v this should be e.

  6. added this to the upkeep milestone on Feb 20, 2024
  7. szhorvat commented on Jun 16, 2024

    @szhorvat
    Member

    We need to make a decision here and then stick with it.

    As I said above, I do not have a strong opinion on what the name should be, only on that it should be consistent.

    To push things forward, I propose using v with the reasoning that it's generic (does not imply integers) and simple. Please comment on whether you agree / disagree, or make counterproposals we can vote on.

    Currently some functions use v (e.g. degree), some use vids (e.g. closeness), some use index (e.g. vertex_attr), some use nodes (e.g. alpha_centrality).

    Some use context-specific names such as from and to. E.g. distances uses v and to while shortest_paths uses from and to. I suggest always using context-specific names when it makes sense, i.e. eventually transitioning distances to from/to as well.

    Why is this decision urgent? While refactoring function for consistency is not urgent, we need a decision now so we can use consistent naming in newly added functions.

  8. maelle commented on Jun 18, 2024

    @maelle
    ContributorAuthor

    if we didn't have any renaming to do, I'd actually be in favor of something more explicit like vertices. 😅

  9. krlmlr commented on Jun 18, 2024

    @krlmlr
    Contributor

    vertices and from_vertices + to_vertices ?

  10. szhorvat commented on Jun 18, 2024

    @szhorvat
    Member

    As I said, I'll accept anything. Just pointing out some disadvantages:

    • No current function uses vertices. Going with it will cause more inconvenience than any other choice.
    • Our primary users are not developers but researchers. Spelling out everything is not the most productive approach in this context. If we are consistent, it will be clear to everyone with minimal experience that v means vertices. Learning this is a one-time cost. Having to type out vertices every time is a major inconvenience that continually affects people who use igraph—it's an ongoing cost. We need to support people who use igraph interactively at least as much as other packages depending on igraph.
  11. krlmlr commented on Jun 19, 2024

    @krlmlr
    Contributor

    We could switch to something like v and e if this consistently means the same for all functions. Can we do a survey across all functions before committing to such a change?

  12. maelle commented on Jun 20, 2024

    @maelle
    ContributorAuthor

    @szhorvat that's an interesting point. I'd assume many people use some sort of code editor with autocompletion (like RStudio IDE) but maybe not.

  13. maelle commented on Jun 20, 2024

    @maelle
    ContributorAuthor

    Let me find what tool one can use to easily create an overview of function arguments.

  14. maelle commented on Jun 20, 2024

    @maelle
    ContributorAuthor

    Current best bet is an archived package https://github.com/ropensci-archive/pkginspector/blob/master/README-NOT.md, I'll keep exploring

  15. maelle commented on Jun 20, 2024

    @maelle
    ContributorAuthor

    It's nice that pkginspector uses igraph :-)

  16. removed their assignment
    on Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    argument consistencyissues related to argument naming/defaultslifecycleDeprecating old APIs

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions