Skip to content

Update GBML Config Wrapper to house {node|edge}_type_to_*_maps.#643

Open
svij-sc wants to merge 2 commits into
mainfrom
svij/typed-feature-maps
Open

Update GBML Config Wrapper to house {node|edge}_type_to_*_maps.#643
svij-sc wants to merge 2 commits into
mainfrom
svij/typed-feature-maps

Conversation

@svij-sc
Copy link
Copy Markdown
Collaborator

@svij-sc svij-sc commented May 18, 2026

Prior to this change one would need to manually convert condensed_{node|edge}_type_*_maps manually to {node|edge}_type_to_*_maps using information available in graph_metadata. This causes a lot of duplicity in code when we can just create convenience functions in the gbml wrapper.

Comment thread pyproject.toml
"mdformat==0.7.22",
"mdformat_tables==1.0.0",
"ty~=0.0.29",
"ty==0.0.31",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newer ty is more restrictive; so actually locking it.

"_node_type_to_feature_dim_map",
{
graph_metadata.condensed_node_type_to_node_type_map[c]: d
for c, d in preprocessed_metadata.condensed_node_type_to_feature_dim_map.items()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: pref to use better var names than c and d. Ditto elsewhere.

return self._preprocessed_metadata_pb_wrapper

@property
def node_type_to_feature_dim_map(self) -> dict[NodeType, int]:
Copy link
Copy Markdown
Collaborator

@mkolodner-sc mkolodner-sc May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For better cohesion, I think these fields belong on PreprocessedMetadataPbWrapper rather than GbmlConfigPbWrapper. Many GiGL functions — like this one — accept PreprocessedMetadataPbWrapper and GraphMetadataPbWrapper directly (not GbmlConfigPbWrapper), so they can't benefit from this change as currently placed. Putting the typed-keyed maps on PreprocessedMetadataPbWrapper (via a method that accepts a GraphMetadataPbWrapper) would make them reachable anywhere the preprocessed metadata is available, and would let callers like the linked function simplify their internal condensed-typed translation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants