MCPcopy
hub / github.com/dmlc/dgl / num_edges

Method num_edges

python/dgl/distributed/dist_graph.py:1192–1225  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 15

number_of_edgesMethod · 0.95
setup_moduleFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
gspmmFunction · 0.45
__call__Method · 0.45
sample_blocksMethod · 0.45
_get_shared_mem_edataFunction · 0.45
partition_graphFunction · 0.45

Calls 2

_num_edgesMethod · 0.80
sumFunction · 0.50

Tested by 1

setup_moduleFunction · 0.76