Convert from coo arrays. Parameters ---------- num_nodes : int Number of nodes. src : Tensor Src end nodes of the edges. dst : Tensor Dst end nodes of the edges. readonly : bool True if the returned graph is readonly. Returns -------
(num_nodes, src, dst, readonly)
| 1060 | # Conversion functions |
| 1061 | ############################################################### |
| 1062 | def from_coo(num_nodes, src, dst, readonly): |
| 1063 | """Convert from coo arrays. |
| 1064 | |
| 1065 | Parameters |
| 1066 | ---------- |
| 1067 | num_nodes : int |
| 1068 | Number of nodes. |
| 1069 | src : Tensor |
| 1070 | Src end nodes of the edges. |
| 1071 | dst : Tensor |
| 1072 | Dst end nodes of the edges. |
| 1073 | readonly : bool |
| 1074 | True if the returned graph is readonly. |
| 1075 | |
| 1076 | Returns |
| 1077 | ------- |
| 1078 | GraphIndex |
| 1079 | The graph index. |
| 1080 | """ |
| 1081 | src = utils.toindex(src) |
| 1082 | dst = utils.toindex(dst) |
| 1083 | if readonly: |
| 1084 | gidx = _CAPI_DGLGraphCreate( |
| 1085 | src.todgltensor(), dst.todgltensor(), int(num_nodes), readonly |
| 1086 | ) |
| 1087 | else: |
| 1088 | gidx = _CAPI_DGLGraphCreateMutable() |
| 1089 | gidx.add_nodes(num_nodes) |
| 1090 | gidx.add_edges(src, dst) |
| 1091 | return gidx |
| 1092 | |
| 1093 | |
| 1094 | def from_csr(indptr, indices, direction): |
no test coverage detected