Identifiers for graph objects

Hello all,

After a short break, I’m back on DGL related stuff.
I’m trying to associate a unique identifier to each of my graphs along with node_attributes, edge_attributes and labels.
Keeping track of them seems an arduous task.
I could not find any graph_id in dgl.Graph.

Any idea how I can do incorporate id into graph?

My current solution is as follows, but admittedly, it is a bit clunky:

graph_labels = {"glabel": th.tensor([0, 1]), "guid": th.tensor([1])}
save_graphs("test.dgl.graph", g, graph_labels)
map_guid = {'1': 'graph_id_1'}

Thanks so much.

Hi,

It seems not supported by dgl but you could maintain the mappling by your self. It’s just a dict of index and graph_id, as I understood. And I think you can use pickle to save/load them in your case. Is this what you mean?