Skip to content

Commit ed9740e

Browse files
Merge pull request #188 from JuliaML/cl/fix
fix PolBlogs
2 parents 43d562f + dde8ce9 commit ed9740e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/datasets/graphs/polblogs.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,22 @@ end
3333

3434
function PolBlogs(; dir=nothing)
3535
DEPNAME = "PolBlogs"
36-
DATA = ["adjacency.csv", "labels.csv"]
36+
DATA = ["adjacency.tsv", "labels.tsv", "names.tsv"]
3737

3838
path = datafile(DEPNAME, DATA[1], dir)
39-
adj = 1 .+ Matrix{Int64}(readdlm(path, ','))
39+
adj = 1 .+ Matrix{Int64}(readdlm(path, '\t')[:,1:2])
4040
s, t = adj[:,1], adj[:,2]
4141

4242
path = datafile(DEPNAME, DATA[2], dir)
43-
labels = Matrix{Int64}(readdlm(path, ',')) |> vec
43+
labels = Matrix{Int}(readdlm(path, '\t')) |> vec
44+
45+
path = datafile(DEPNAME, DATA[3], dir)
46+
names = Matrix{String}(readdlm(path, '\t')) |> vec
4447

4548
metadata = Dict{String, Any}()
4649
g = Graph(; num_nodes = 1490,
4750
edge_index = (s, t),
48-
node_data = (; labels))
51+
node_data = (; labels, names))
4952

5053
return PolBlogs(metadata, [g])
5154
end

test/datasets/graphs.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ end
8686
@test g.num_edges == 19025
8787
@test size(g.node_data.labels) == (g.num_nodes,)
8888
@test sort(unique(g.node_data.labels)) == [0, 1]
89+
@test g.node_data.names isa Vector{String}
90+
@test size(g.node_data.names) == (g.num_nodes,)
8991

9092
@test g.edge_index isa Tuple{Vector{Int}, Vector{Int}}
9193
s, t = g.edge_index

0 commit comments

Comments
 (0)