Unverified Commit 6f28e1ad authored by Songqing Zhang's avatar Songqing Zhang Committed by GitHub
Browse files

[misc] Fix build warnings (#6037)


Co-authored-by: default avatarHongzhi (Steve), Chen <chenhongzhi.nkcs@gmail.com>
parent 6af55f18
......@@ -1017,7 +1017,7 @@ class HeteroGraphIndex(ObjectBase):
raise DGLError("Invalid incidence matrix type: %s" % str(typestr))
return inc, shuffle_idx
def node_subgraph(self, induced_nodes, relabel_nodes):
def node_subgraph(self, induced_nodes):
"""Return the induced node subgraph.
Parameters
......@@ -1025,9 +1025,6 @@ class HeteroGraphIndex(ObjectBase):
induced_nodes : list of utils.Index
Induced nodes. The length should be equal to the number of
node types in this heterograph.
relabel_nodes : bool
If True, the extracted subgraph will only have the nodes in the specified node set
and it will relabel the nodes in order.
Returns
-------
......@@ -1035,7 +1032,7 @@ class HeteroGraphIndex(ObjectBase):
The subgraph index.
"""
vids = [F.to_dgl_nd(nodes) for nodes in induced_nodes]
return _CAPI_DGLHeteroVertexSubgraph(self, vids, relabel_nodes)
return _CAPI_DGLHeteroVertexSubgraph(self, vids)
def edge_subgraph(self, induced_edges, preserve_nodes):
"""Return the induced edge subgraph.
......
......@@ -161,7 +161,7 @@ def node_subgraph(
nodes.get(ntype, F.copy_to(F.tensor([], graph.idtype), device))
for ntype in graph.ntypes
]
sgi = graph._graph.node_subgraph(induced_nodes, relabel_nodes)
sgi = graph._graph.node_subgraph(induced_nodes)
induced_edges = sgi.induced_edges
if not relabel_nodes:
sgi = graph._graph.edge_subgraph(induced_edges, True)
......
......@@ -383,9 +383,9 @@ List<Value> Libra2dglBuildDict(
while (!feof(fp) && edge < fsize) {
int64_t u, v;
float w;
fscanf(
fp, "%ld,%ld,%f\n", &u, &v,
&w); // reading an edge - the src and dst global node IDs
CHECK_EQ(
fscanf(fp, "%ld,%ld,%f\n", &u, &v, &w),
3); // reading an edge - the src and dst global node IDs
if (indices_ptr[u] ==
-100) { // if already not assigned a local node ID, local node ID is
......
......@@ -403,7 +403,6 @@ DGL_REGISTER_GLOBAL("heterograph_index._CAPI_DGLHeteroVertexSubgraph")
.set_body([](DGLArgs args, DGLRetValue* rv) {
HeteroGraphRef hg = args[0];
List<Value> vids = args[1];
bool relabel_nodes = args[2];
std::vector<IdArray> vid_vec;
vid_vec.reserve(vids.size());
for (Value val : vids) {
......
......@@ -1169,11 +1169,15 @@ NegSubgraph EdgeSamplerObject::genNegEdgeSubgraph(
}
prev_neg_offset = neg_vids.size();
randomSample(num_tot_nodes, neg_sample_size, exclude, &neg_vids);
assert(prev_neg_offset + neg_sample_size == neg_vids.size());
assert(
static_cast<size_t>(prev_neg_offset + neg_sample_size) ==
neg_vids.size());
} else if (neg_sample_size < num_tot_nodes) {
prev_neg_offset = neg_vids.size();
randomSample(num_tot_nodes, neg_sample_size, &neg_vids);
assert(prev_neg_offset + neg_sample_size == neg_vids.size());
assert(
static_cast<size_t>(prev_neg_offset + neg_sample_size) ==
neg_vids.size());
} else if (exclude_positive) {
LOG(FATAL) << "We can't exclude positive edges"
"when sampling negative edges with all nodes.";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment