How do you iterate through Heterograph for 1 specific node?

I have a heterograph on DGL with multiple node and edge types. I have visualized the graph schema with pygraphviz and I want to do something similar but with actual values. For example, for customer 0, all the relevant node index values would be there instead of node types. Is there any method to do the same?

The schema code:

dot = graphviz.Digraph()
for u, v, k in g.metagraph().edges(keys=True):
        dot.edge(u, v, label='  '+k)

dot

I’m not quite sure what you are trying to achieve here.

You could find the neighbors of a node with in_edges or out_edges, where you can specify the edge type. So you can find the orders a customer ordered with something like

graph.out_edges(customer_id, etype='ordered')

I understand. I think through that, I’d be able to generate a local view of the graph. Will update here again if not possible. Thank you

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