11
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
- """graph saint sample test"""
15
-
14
+ """graph saint sample test
15
+ """
16
+ from __future__ import division
17
+ from __future__ import absolute_import
18
+ from __future__ import print_function
19
+ from __future__ import unicode_literals
16
20
import unittest
21
+ import numpy as np
17
22
18
23
import pgl
19
- import numpy as np
20
24
import paddle .fluid as fluid
21
25
from pgl .sample import graph_saint_random_walk_sample
22
26
@@ -25,14 +29,14 @@ class GraphSaintSampleTest(unittest.TestCase):
25
29
"""GraphSaintSampleTest"""
26
30
27
31
def test_randomwalk_sampler (self ):
28
- """test_scatter_add """
32
+ """test_randomwalk_sampler """
29
33
g = pgl .graph .Graph (
30
34
num_nodes = 8 ,
31
35
edges = [(1 , 2 ), (2 , 3 ), (0 , 2 ), (0 , 1 ), (6 , 7 ), (4 , 5 ), (6 , 4 ),
32
36
(7 , 4 ), (3 , 4 )])
33
37
subgraph = graph_saint_random_walk_sample (g , [6 , 7 ], 2 )
34
- print ('reinded ' , subgraph ._from_reindex )
35
- print ('sub_edges ' , subgraph .edges )
38
+ print ('reindex ' , subgraph ._from_reindex )
39
+ print ('subedges ' , subgraph .edges )
36
40
assert len (subgraph .nodes ) == 4
37
41
assert len (subgraph .edges ) == 4
38
42
true_edges = np .array ([[0 , 1 ], [2 , 3 ], [2 , 0 ], [3 , 0 ]])
0 commit comments