Add graph vertices that will be loaded from a given path. Args: source (string): Data source path where to load the nodes. node_type (string): Indicates the type of the added nodes. decoder (Decoder): A Decoder object to describe the data schema. mask (TRAIN | TEST | VA
(self,
source,
node_type,
decoder,
option=None,
mask=utils.Mask.NONE)
| 198 | return data.Decoder(weighted, labeled, attr_types) |
| 199 | |
| 200 | def node(self, |
| 201 | source, |
| 202 | node_type, |
| 203 | decoder, |
| 204 | option=None, |
| 205 | mask=utils.Mask.NONE): |
| 206 | """ Add graph vertices that will be loaded from a given path. |
| 207 | |
| 208 | Args: |
| 209 | source (string): Data source path where to load the nodes. |
| 210 | node_type (string): Indicates the type of the added nodes. |
| 211 | decoder (Decoder): A Decoder object to describe the data schema. |
| 212 | mask (TRAIN | TEST | VAL): Mark the source as TRAIN data, TEST data |
| 213 | or VAL data for the given node_type in the graph. |
| 214 | """ |
| 215 | if not isinstance(source, str): |
| 216 | raise ValueError('source for node() must be string.') |
| 217 | if not isinstance(node_type, str): |
| 218 | raise ValueError('node_type for node() must be string.') |
| 219 | if not isinstance(decoder, data.Decoder): |
| 220 | raise ValueError('decoder must be an instance of `Decoder`, got {}' |
| 221 | .format(type(decoder))) |
| 222 | |
| 223 | node_type = utils.get_mask_type(node_type, mask) |
| 224 | self._node_decoders[node_type] = decoder |
| 225 | node_source = self._construct_node_source(source, node_type, decoder, option) |
| 226 | self._node_sources.append(node_source) |
| 227 | return self |
| 228 | |
| 229 | def _copy_node_source(self, node): |
| 230 | result = pywrap.NodeSource() |