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

Method _generate

python/dgl/data/minigc.py:166–181  ·  view source on GitHub ↗
(self, seed)

Source from the content-addressed store, hash-verified

164 return 8
165
166 def _generate(self, seed):
167 if seed is not None:
168 np.random.seed(seed)
169 self._gen_cycle(self.num_graphs // 8)
170 self._gen_star(self.num_graphs // 8)
171 self._gen_wheel(self.num_graphs // 8)
172 self._gen_lollipop(self.num_graphs // 8)
173 self._gen_hypercube(self.num_graphs // 8)
174 self._gen_grid(self.num_graphs // 8)
175 self._gen_clique(self.num_graphs // 8)
176 self._gen_circular_ladder(self.num_graphs - len(self.graphs))
177 # preprocess
178 for i in range(self.num_graphs):
179 # convert to DGLGraph, and add self loops
180 self.graphs[i] = add_self_loop(from_networkx(self.graphs[i]))
181 self.labels = F.tensor(np.array(self.labels).astype(np.int64))
182
183 def _gen_cycle(self, n):
184 for _ in range(n):

Callers 1

processMethod · 0.95

Calls 11

_gen_cycleMethod · 0.95
_gen_starMethod · 0.95
_gen_wheelMethod · 0.95
_gen_lollipopMethod · 0.95
_gen_hypercubeMethod · 0.95
_gen_gridMethod · 0.95
_gen_cliqueMethod · 0.95
_gen_circular_ladderMethod · 0.95
add_self_loopFunction · 0.85
from_networkxFunction · 0.50
astypeMethod · 0.45

Tested by

no test coverage detected