Question about creating graphs

Hi, I noticed there are two ways of creating a graph:

  1. dgl.DGLGraph((u, v))
  2. create a graph by progressively adding more nodes and edges. (call add_nodes and add_edge)

If I have 2 same graphs, one is created by method 1 and the other is created by method 2. And I perform same message passing and reducing function on them, will the speed be different?

No, there will not be difference in terms of speed because we will create csr and csc matrices when calling message passing functions.

We separate the two settings (immutable and mutable) graph because it’s costly to maintain csr/csc matrix for dynamic graphs.

In the next release we will not distinguish the two settings.

Got it! Thank you for your reply!