Return the total number of edges in the distributed graph. Parameters ---------- etype : str or (str, str, str), optional The type name of the edges. The allowed type name formats are: * ``(str, str, str)`` for source node type, edge type and destina
(self, etype=None)
| 1190 | return self._gpb._num_nodes(ntype) |
| 1191 | |
| 1192 | def num_edges(self, etype=None): |
| 1193 | """Return the total number of edges in the distributed graph. |
| 1194 | |
| 1195 | Parameters |
| 1196 | ---------- |
| 1197 | etype : str or (str, str, str), optional |
| 1198 | The type name of the edges. The allowed type name formats are: |
| 1199 | |
| 1200 | * ``(str, str, str)`` for source node type, edge type and destination node type. |
| 1201 | * or one ``str`` edge type name if the name can uniquely identify a |
| 1202 | triplet format in the graph. |
| 1203 | |
| 1204 | If not provided, return the total number of edges regardless of the types |
| 1205 | in the graph. |
| 1206 | |
| 1207 | Returns |
| 1208 | ------- |
| 1209 | int |
| 1210 | The number of edges |
| 1211 | |
| 1212 | Examples |
| 1213 | -------- |
| 1214 | >>> g = dgl.distributed.DistGraph('ogb-product') |
| 1215 | >>> print(g.num_edges()) |
| 1216 | 123718280 |
| 1217 | """ |
| 1218 | if etype is None: |
| 1219 | return sum( |
| 1220 | [ |
| 1221 | self._gpb._num_edges(c_etype) |
| 1222 | for c_etype in self.canonical_etypes |
| 1223 | ] |
| 1224 | ) |
| 1225 | return self._gpb._num_edges(etype) |
| 1226 | |
| 1227 | def out_degrees(self, u=ALL): |
| 1228 | """Return the out-degree(s) of the given nodes. |