How to remove multiple types of nodes simultaneously with eid stored

we can remove a single type of nodes in a hetero graph by

g.remove_nodes(nid_list, ntype=target_ntype,store_ids=True)

however, I wanna remove multiple types of nodes at the same time. if I remove a single type of nodes iteratively, i.e.,

g.remove_nodes(nid_list_1, ntype=target_ntype_1,store_ids=True)
g.remove_nodes(nid_list_2, ntype=target_ntype_2,store_ids=True)

the stored ids will not be the original ids.

I’m afraid there does not exist such API for now. One WAR is keep track original eids after each iteration and backward when querying original eids.

Yes, I stored original nids as a new node feature. Anyway, an API that enable removing multiple types of nodes will be helpful!

Yes. I have created an ticket to track your request: remove multiple nodes/edges types simultaneously from heterograph · Issue #3387 · dmlc/dgl · GitHub. will get back to you if any update.

1 Like