An EdgeView class to act as G.edges for a DistGraph.
| 351 | |
| 352 | |
| 353 | class HeteroEdgeView(object): |
| 354 | """An EdgeView class to act as G.edges for a DistGraph.""" |
| 355 | |
| 356 | __slots__ = ["_graph"] |
| 357 | |
| 358 | def __init__(self, graph): |
| 359 | self._graph = graph |
| 360 | |
| 361 | def __getitem__(self, key): |
| 362 | assert isinstance(key, str) or ( |
| 363 | isinstance(key, tuple) and len(key) == 3 |
| 364 | ), f"Expect edge type in string or triplet of string, but got {key}." |
| 365 | return EdgeSpace(data=EdgeDataView(self._graph, key)) |
| 366 | |
| 367 | |
| 368 | class NodeDataView(MutableMapping): |