Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
6f28e1ad
Unverified
Commit
6f28e1ad
authored
Jul 26, 2023
by
Songqing Zhang
Committed by
GitHub
Jul 26, 2023
Browse files
[misc] Fix build warnings (#6037)
Co-authored-by:
Hongzhi (Steve), Chen
<
chenhongzhi.nkcs@gmail.com
>
parent
6af55f18
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
12 deletions
+12
-12
python/dgl/heterograph_index.py
python/dgl/heterograph_index.py
+2
-5
python/dgl/subgraph.py
python/dgl/subgraph.py
+1
-1
src/array/libra_partition.cc
src/array/libra_partition.cc
+3
-3
src/graph/heterograph_capi.cc
src/graph/heterograph_capi.cc
+0
-1
src/graph/sampler.cc
src/graph/sampler.cc
+6
-2
No files found.
python/dgl/heterograph_index.py
View file @
6f28e1ad
...
@@ -1017,7 +1017,7 @@ class HeteroGraphIndex(ObjectBase):
...
@@ -1017,7 +1017,7 @@ class HeteroGraphIndex(ObjectBase):
raise
DGLError
(
"Invalid incidence matrix type: %s"
%
str
(
typestr
))
raise
DGLError
(
"Invalid incidence matrix type: %s"
%
str
(
typestr
))
return
inc
,
shuffle_idx
return
inc
,
shuffle_idx
def
node_subgraph
(
self
,
induced_nodes
,
relabel_nodes
):
def
node_subgraph
(
self
,
induced_nodes
):
"""Return the induced node subgraph.
"""Return the induced node subgraph.
Parameters
Parameters
...
@@ -1025,9 +1025,6 @@ class HeteroGraphIndex(ObjectBase):
...
@@ -1025,9 +1025,6 @@ class HeteroGraphIndex(ObjectBase):
induced_nodes : list of utils.Index
induced_nodes : list of utils.Index
Induced nodes. The length should be equal to the number of
Induced nodes. The length should be equal to the number of
node types in this heterograph.
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
Returns
-------
-------
...
@@ -1035,7 +1032,7 @@ class HeteroGraphIndex(ObjectBase):
...
@@ -1035,7 +1032,7 @@ class HeteroGraphIndex(ObjectBase):
The subgraph index.
The subgraph index.
"""
"""
vids
=
[
F
.
to_dgl_nd
(
nodes
)
for
nodes
in
induced_nodes
]
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
):
def
edge_subgraph
(
self
,
induced_edges
,
preserve_nodes
):
"""Return the induced edge subgraph.
"""Return the induced edge subgraph.
...
...
python/dgl/subgraph.py
View file @
6f28e1ad
...
@@ -161,7 +161,7 @@ def node_subgraph(
...
@@ -161,7 +161,7 @@ def node_subgraph(
nodes
.
get
(
ntype
,
F
.
copy_to
(
F
.
tensor
([],
graph
.
idtype
),
device
))
nodes
.
get
(
ntype
,
F
.
copy_to
(
F
.
tensor
([],
graph
.
idtype
),
device
))
for
ntype
in
graph
.
ntypes
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
induced_edges
=
sgi
.
induced_edges
if
not
relabel_nodes
:
if
not
relabel_nodes
:
sgi
=
graph
.
_graph
.
edge_subgraph
(
induced_edges
,
True
)
sgi
=
graph
.
_graph
.
edge_subgraph
(
induced_edges
,
True
)
...
...
src/array/libra_partition.cc
View file @
6f28e1ad
...
@@ -383,9 +383,9 @@ List<Value> Libra2dglBuildDict(
...
@@ -383,9 +383,9 @@ List<Value> Libra2dglBuildDict(
while
(
!
feof
(
fp
)
&&
edge
<
fsize
)
{
while
(
!
feof
(
fp
)
&&
edge
<
fsize
)
{
int64_t
u
,
v
;
int64_t
u
,
v
;
float
w
;
float
w
;
fscanf
(
CHECK_EQ
(
fp
,
"%ld,%ld,%f
\n
"
,
&
u
,
&
v
,
fscanf
(
fp
,
"%ld,%ld,%f
\n
"
,
&
u
,
&
v
,
&
w
),
&
w
);
// reading an edge - the src and dst global node IDs
3
);
// reading an edge - the src and dst global node IDs
if
(
indices_ptr
[
u
]
==
if
(
indices_ptr
[
u
]
==
-
100
)
{
// if already not assigned a local node ID, local node ID is
-
100
)
{
// if already not assigned a local node ID, local node ID is
...
...
src/graph/heterograph_capi.cc
View file @
6f28e1ad
...
@@ -403,7 +403,6 @@ DGL_REGISTER_GLOBAL("heterograph_index._CAPI_DGLHeteroVertexSubgraph")
...
@@ -403,7 +403,6 @@ DGL_REGISTER_GLOBAL("heterograph_index._CAPI_DGLHeteroVertexSubgraph")
.
set_body
([](
DGLArgs
args
,
DGLRetValue
*
rv
)
{
.
set_body
([](
DGLArgs
args
,
DGLRetValue
*
rv
)
{
HeteroGraphRef
hg
=
args
[
0
];
HeteroGraphRef
hg
=
args
[
0
];
List
<
Value
>
vids
=
args
[
1
];
List
<
Value
>
vids
=
args
[
1
];
bool
relabel_nodes
=
args
[
2
];
std
::
vector
<
IdArray
>
vid_vec
;
std
::
vector
<
IdArray
>
vid_vec
;
vid_vec
.
reserve
(
vids
.
size
());
vid_vec
.
reserve
(
vids
.
size
());
for
(
Value
val
:
vids
)
{
for
(
Value
val
:
vids
)
{
...
...
src/graph/sampler.cc
View file @
6f28e1ad
...
@@ -1169,11 +1169,15 @@ NegSubgraph EdgeSamplerObject::genNegEdgeSubgraph(
...
@@ -1169,11 +1169,15 @@ NegSubgraph EdgeSamplerObject::genNegEdgeSubgraph(
}
}
prev_neg_offset
=
neg_vids
.
size
();
prev_neg_offset
=
neg_vids
.
size
();
randomSample
(
num_tot_nodes
,
neg_sample_size
,
exclude
,
&
neg_vids
);
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
)
{
}
else
if
(
neg_sample_size
<
num_tot_nodes
)
{
prev_neg_offset
=
neg_vids
.
size
();
prev_neg_offset
=
neg_vids
.
size
();
randomSample
(
num_tot_nodes
,
neg_sample_size
,
&
neg_vids
);
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
)
{
}
else
if
(
exclude_positive
)
{
LOG
(
FATAL
)
<<
"We can't exclude positive edges"
LOG
(
FATAL
)
<<
"We can't exclude positive edges"
"when sampling negative edges with all nodes."
;
"when sampling negative edges with all nodes."
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment