r""" Description ----------- Transform the graph corresponding to a canonical edge type. Parameters ---------- c_etype : tuple of str A canonical edge type. g : DGLGraph The graph. Returns -------
(self, c_etype, g)
| 596 | self.fill_data = fill_data |
| 597 | |
| 598 | def transform_etype(self, c_etype, g): |
| 599 | r""" |
| 600 | |
| 601 | Description |
| 602 | ----------- |
| 603 | Transform the graph corresponding to a canonical edge type. |
| 604 | |
| 605 | Parameters |
| 606 | ---------- |
| 607 | c_etype : tuple of str |
| 608 | A canonical edge type. |
| 609 | g : DGLGraph |
| 610 | The graph. |
| 611 | |
| 612 | Returns |
| 613 | ------- |
| 614 | DGLGraph |
| 615 | The transformed graph. |
| 616 | """ |
| 617 | utype, _, vtype = c_etype |
| 618 | if utype != vtype: |
| 619 | return g |
| 620 | |
| 621 | if not self.allow_duplicate: |
| 622 | g = functional.remove_self_loop(g, etype=c_etype) |
| 623 | return functional.add_self_loop( |
| 624 | g, |
| 625 | edge_feat_names=self.edge_feat_names, |
| 626 | fill_data=self.fill_data, |
| 627 | etype=c_etype, |
| 628 | ) |
| 629 | |
| 630 | def __call__(self, g): |
| 631 | for c_etype in g.canonical_etypes: |