Heterogeneous graph: what if different graph instance contain slightly different metadata?

For example, given 100 heterogeneous graphs, some of them have the edge type “author (works with) author” while such a edge type does not exist in other graphs in the 100 ones.

One idea is to generate “virtual nodes and edges” to make up non-existing edge types (node types) and all graphs have the same metadata, which is actually the union of all metadata in different graphs.

But this one may be too dirty and harms efficiency. Any better solution?

why do you need to force all heterographs have same metadata? what’s you task? graph classification? I don’t think we need to generate virtual nodes/edges as we could just skip operations on such non-existent edge types. Here’s an example for heterograph classification: 5.4 Graph Classification — DGL 0.8 documentation.

As you said, you can have placeholders for non-existing node and/or edge types like below.

import dgl

g1 = dgl.heterograph({
	('N1', 'R1', 'N1'): ([0, 1], [1, 2]),
	('N1', 'R2', 'N2'): ([1], [2])
	})

g2 = dgl.heterograph({
	('N1', 'R1', 'N1'): ([0, 1], [1, 2]),
	('N1', 'R2', 'N2'): ([], [])
	})

bg = dgl.batch([g1, g2])

Please let us know if you encounter efficiency problems.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.