Sampling function Parameters ---------- g : DGLGraph The graph to sample from. indices : Tensor Placeholder not used. Returns ------- DGLGraph The sampled subgraph.
(self, g, indices)
| 140 | return sampled_nodes.unique().type(g.idtype) |
| 141 | |
| 142 | def sample(self, g, indices): |
| 143 | """Sampling function |
| 144 | |
| 145 | Parameters |
| 146 | ---------- |
| 147 | g : DGLGraph |
| 148 | The graph to sample from. |
| 149 | indices : Tensor |
| 150 | Placeholder not used. |
| 151 | |
| 152 | Returns |
| 153 | ------- |
| 154 | DGLGraph |
| 155 | The sampled subgraph. |
| 156 | """ |
| 157 | node_ids = self.sampler(g) |
| 158 | sg = g.subgraph( |
| 159 | node_ids, relabel_nodes=True, output_device=self.output_device |
| 160 | ) |
| 161 | set_node_lazy_features(sg, self.prefetch_ndata) |
| 162 | set_edge_lazy_features(sg, self.prefetch_edata) |
| 163 | return sg |
nothing calls this directly
no test coverage detected