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

Method __repr__

python/dgl/heterograph.py:6640–6676  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

6638 is_block = True
6639
6640 def __repr__(self):
6641 if (
6642 len(self.srctypes) == 1
6643 and len(self.dsttypes) == 1
6644 and len(self.etypes) == 1
6645 ):
6646 ret = "Block(num_src_nodes={srcnode}, num_dst_nodes={dstnode}, num_edges={edge})"
6647 return ret.format(
6648 srcnode=self.number_of_src_nodes(),
6649 dstnode=self.number_of_dst_nodes(),
6650 edge=self.num_edges(),
6651 )
6652 else:
6653 ret = (
6654 "Block(num_src_nodes={srcnode},\n"
6655 " num_dst_nodes={dstnode},\n"
6656 " num_edges={edge},\n"
6657 " metagraph={meta})"
6658 )
6659 nsrcnode_dict = {
6660 ntype: self.number_of_src_nodes(ntype)
6661 for ntype in self.srctypes
6662 }
6663 ndstnode_dict = {
6664 ntype: self.number_of_dst_nodes(ntype)
6665 for ntype in self.dsttypes
6666 }
6667 nedge_dict = {
6668 etype: self.num_edges(etype) for etype in self.canonical_etypes
6669 }
6670 meta = str(self.metagraph().edges(keys=True))
6671 return ret.format(
6672 srcnode=nsrcnode_dict,
6673 dstnode=ndstnode_dict,
6674 edge=nedge_dict,
6675 meta=meta,
6676 )
6677
6678
6679def _create_compute_graph(graph, u, v, eid, recv_nodes=None):

Callers

nothing calls this directly

Calls 6

formatMethod · 0.80
number_of_src_nodesMethod · 0.80
number_of_dst_nodesMethod · 0.80
num_edgesMethod · 0.45
edgesMethod · 0.45
metagraphMethod · 0.45

Tested by

no test coverage detected