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

Method bits_needed

python/dgl/heterograph_index.py:200–221  ·  view source on GitHub ↗

Return the number of integer bits needed to represent the unitgraph graph. Parameters ---------- etype : int The edge type. Returns ------- int The number of bits needed.

(self, etype)

Source from the content-addressed store, hash-verified

198 return _CAPI_DGLHeteroContext(self)
199
200 def bits_needed(self, etype):
201 """Return the number of integer bits needed to represent the unitgraph graph.
202
203 Parameters
204 ----------
205 etype : int
206 The edge type.
207
208 Returns
209 -------
210 int
211 The number of bits needed.
212 """
213 stype, dtype = self.metagraph.find_edge(etype)
214 if (
215 self.num_edges(etype) >= 0x80000000
216 or self.num_nodes(stype) >= 0x80000000
217 or self.num_nodes(dtype) >= 0x80000000
218 ):
219 return 64
220 else:
221 return 32
222
223 def asbits(self, bits):
224 """Transform the graph to a new one with the given number of bits storage.

Callers 1

get_unitgraphMethod · 0.95

Calls 3

num_edgesMethod · 0.95
num_nodesMethod · 0.95
find_edgeMethod · 0.80

Tested by

no test coverage detected