33# ================================================================
44
55"""
6- abstract type AbstractGraphKernel
6+ abstract type AbstractGraphKernel <: KernelFunctions.Kernel
77
88A kernel function between two graphs.
99
@@ -17,10 +17,10 @@ that transforms a single graph into a suitable representation and `apply_preproc
1717takes the representations for both graphs and calculates the kernel function.
1818
1919### See also
20- [`preprocessed_form`](@ref), [`apply_preprocessed`](@ref), [`kernel_matrix`](@ref), [`kernel_matrix_diag`](@ref)
20+ [`preprocessed_form`](@ref), [`apply_preprocessed`](@ref), [`KernelFunctions.Kernel`](@ref), [` kernel_matrix`](@ref), [`kernel_matrix_diag`](@ref)
2121
2222"""
23- abstract type AbstractGraphKernel end
23+ abstract type AbstractGraphKernel <: KernelFunctions.Kernel end
2424
2525"""
2626 preprocessed_form(k::AbstractGraphKernel, g::AbstractGraph) = g
@@ -39,7 +39,7 @@ method.
3939"""
4040preprocessed_form (:: AbstractGraphKernel , g:: AbstractGraph ) = g
4141
42- function (kernel:: AbstractGraphKernel )(g1, g2)
42+ function (kernel:: AbstractGraphKernel )(g1:: AbstractGraph , g2:: AbstractGraph )
4343
4444 return apply_preprocessed (kernel, preprocessed_form (kernel, g1), preprocessed_form (kernel, g2))
4545end
@@ -52,7 +52,7 @@ function _map_preprocessed_form(kernel::AbstractGraphKernel, graphs)
5252
5353 # TODO we should be able to avoid collecting the graphs
5454 # but currently ThreadX cannot split them otherwise,
55- # maybe we can create some wrapper type that is splitable around graphs
55+ # maybe we can create some wrapper type that is splittable around graphs
5656 return ThreadsX. map (g -> preprocessed_form (kernel, g), collect (graphs))
5757end
5858
@@ -63,7 +63,7 @@ Return a matrix of running the kernel on all pairs of graphs.
6363### See also
6464[`kernelmatrix_diag`](@ref)
6565"""
66- function kernelmatrix (kernel:: AbstractGraphKernel , graphs)
66+ function KernelFunctions . kernelmatrix (kernel:: AbstractGraphKernel , graphs:: AbstractVector )
6767
6868 pre = _map_preprocessed_form (kernel, graphs)
6969
@@ -92,15 +92,7 @@ function _kernelmatrix_from_preprocessed(kernel, pre)
9292 return G
9393end
9494
95- """
96- kernelmatrix_diag(kernel::AbstractGraphKernel, graphs)
97-
98- Calculate the diagonal of the kernelmatrix matrix of the graphs.
99-
100- ### See also
101- [`kernelmatrix`](@ref)
102- """
103- function kernelmatrix_diag (kernel:: AbstractGraphKernel , graphs)
95+ function KernelFunctions. kernelmatrix_diag (kernel:: AbstractGraphKernel , graphs:: AbstractVector )
10496
10597 n = length (graphs)
10698 pre = _map_preprocessed_form (kernel, graphs)
@@ -112,13 +104,8 @@ function kernelmatrix_diag(kernel::AbstractGraphKernel, graphs)
112104 return D
113105end
114106
115- """
116- kernelmatrix(kernel::AbstractGraphKernel, graphs1, graphs2)
117107
118- Calculate a matrix of invoking the kernel on all pairs.
119- Entry `(i, j)` of the resulting matrix contains `kernel(graphs1[i], graphs2[j]`.
120- """
121- function kernelmatrix (kernel:: AbstractGraphKernel , graphs1, graphs2)
108+ function KernelFunctions. kernelmatrix (kernel:: AbstractGraphKernel , graphs1:: AbstractVector , graphs2:: AbstractVector )
122109
123110 n_rows = length (graphs1)
124111 n_cols = length (graphs2)
0 commit comments