Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

addid_to_key as argument to graph constructor #95

Open
@q-aaronzolnailucas

Description

@q-aaronzolnailucas

inga.Graph.__init__ we can specifykey_to_id. I can't see any reason why thismust be astdlib.dict and not any other class that implements thetyping.Mapping protocol (__getitem__,__len__,__iter__). I have a usecase where I have a more memory efficient mapping than a dict and would like to use it.

However, whenever theid_to_key property is used, this will create a full inverse mapping, undoing any memory efficiency. It would be great to be able to pass an inverse mapping optionally (id_to_key) to avoid this calculation if possible. Currently I'm doing:

G=ga.Graph(...,key_to_id=...)G._id_to_key= ...

but obviously this relies on setting the 'private'_id_to_key member, which has no API stability guarantees. I'd be happy to implement this change!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp