Skip to content

Add support for fetching a subgraph by Translator.get_instance() #319

@mdkozlowski

Description

@mdkozlowski

Translator._parse_memgraph uses get_edges_from_db, which matches all edges in Memgraph. For large graphs this is slow and possibly unnecessary (like for my use-case).

I've rewritten the Translator and DGLTranslator classes for my use-case, by adding a Match parameter in .get_instance which is propagated down to the get_edges_from_db function. By providing a Match query on node labels and relationship properties, I can use the customised DGLTranslator to return subgraphs as part of a PyTorch/DGL Dataloader - making it very convenient for model training/prediction.

Is there a technical/conceptual reason the existing Translator class doesn't support optionally fetching a subgraph? My solution is specific to the use-case I have, and as-is, it definitely isn't ready for a PR. But if there is interest for this kind of functionality, I'd be happy to contribute.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions