Skip to content

Commit

Permalink
[misc] Fix build warnings (dmlc#6037)
Browse files Browse the repository at this point in the history
Co-authored-by: Hongzhi (Steve), Chen <[email protected]>
  • Loading branch information
songqing and frozenbugs authored Jul 26, 2023
1 parent 6af55f1 commit 6f28e1a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
7 changes: 2 additions & 5 deletions python/dgl/heterograph_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,25 +1017,22 @@ def incidence_matrix(self, etype, typestr, ctx):
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
----------
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
-------
SubgraphIndex
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.
Expand Down
2 changes: 1 addition & 1 deletion python/dgl/subgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def _process_nodes(ntype, v):
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)
Expand Down
6 changes: 3 additions & 3 deletions src/array/libra_partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/graph/heterograph_capi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 6 additions & 2 deletions src/graph/sampler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.";
Expand Down

0 comments on commit 6f28e1a

Please sign in to comment.