Skip to content

Commit 0ab69ea

Browse files
committed
Revert "format"
This reverts commit 7e0556f.
1 parent 7e0556f commit 0ab69ea

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/GNNGraphs/generate.jl

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ function rand_graph(n::Integer, m::Integer; bidirected=true, seed=-1, kws...)
4141
if bidirected
4242
@assert iseven(m) "Need even number of edges for bidirected graphs, given m=$m."
4343
end
44-
m2 = bidirected ? m ÷ 2 : m
45-
return GNNGraph(Graphs.erdos_renyi(n, m2; is_directed=!bidirected, seed); kws...)
44+
m2 = bidirected ? m÷2 : m
45+
return GNNGraph(Graphs.erdos_renyi(n, m2; is_directed=!bidirected, seed); kws...)
4646
end
4747

4848

@@ -92,11 +92,11 @@ GNNGraph:
9292
9393
```
9494
"""
95-
function knn_graph(points::AbstractMatrix, k::Int;
96-
graph_indicator=nothing,
97-
self_loops=false,
98-
dir=:in,
99-
kws...)
95+
function knn_graph(points::AbstractMatrix, k::Int;
96+
graph_indicator = nothing,
97+
self_loops = false,
98+
dir = :in,
99+
kws...)
100100

101101
if graph_indicator !== nothing
102102
d, n = size(points)
@@ -105,22 +105,22 @@ function knn_graph(points::AbstractMatrix, k::Int;
105105
# All graphs in the batch must have at least k nodes.
106106
cm = StatsBase.countmap(graph_indicator)
107107
@assert all(values(cm) .>= k)
108-
108+
109109
# Make sure that the distance between points in different graphs
110110
# is always larger than any distance within the same graph.
111111
points = points .- minimum(points)
112112
points = points ./ maximum(points)
113113
dummy_feature = 2d .* reshape(graph_indicator, 1, n)
114114
points = vcat(points, dummy_feature)
115115
end
116-
116+
117117
kdtree = NearestNeighbors.KDTree(points)
118118
if !self_loops
119119
k += 1
120120
end
121121
sortres = false
122122
idxs, dists = NearestNeighbors.knn(kdtree, points, k, sortres)
123-
123+
124124
g = GNNGraph(idxs; dir, graph_indicator, kws...)
125125
if !self_loops
126126
g = remove_self_loops(g)
@@ -174,17 +174,17 @@ GNNGraph:
174174
175175
```
176176
"""
177-
function radius_graph(points::AbstractMatrix, r::AbstractFloat;
178-
graph_indicator=nothing,
179-
self_loops=false,
180-
dir=:in,
181-
kws...)
177+
function radius_graph(points::AbstractMatrix, r::AbstractFloat;
178+
graph_indicator = nothing,
179+
self_loops = false,
180+
dir = :in,
181+
kws...)
182182

183183
if graph_indicator !== nothing
184184
d, n = size(points)
185185
@assert graph_indicator isa AbstractVector{<:Integer}
186186
@assert length(graph_indicator) == n
187-
187+
188188
# Make sure that the distance between points in different graphs
189189
# is always larger than r.
190190
dummy_feature = 2r .* reshape(graph_indicator, 1, n)
@@ -195,7 +195,7 @@ function radius_graph(points::AbstractMatrix, r::AbstractFloat;
195195

196196
sortres = false
197197
idxs = NearestNeighbors.inrange(balltree, points, r, sortres)
198-
198+
199199
g = GNNGraph(idxs; dir, graph_indicator, kws...)
200200
if !self_loops
201201
g = remove_self_loops(g)

0 commit comments

Comments
 (0)