diff --git a/docs/make.jl b/docs/make.jl index 8db20b41d..f376bf04b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,5 +1,5 @@ using Documenter -include("../src/LightGraphs.jl") +#include("../src/LightGraphs.jl") using LightGraphs # same for contributing and license diff --git a/src/SimpleGraphs/SimpleGraphs.jl b/src/SimpleGraphs/SimpleGraphs.jl index 7f3f35b15..533e9b2f2 100644 --- a/src/SimpleGraphs/SimpleGraphs.jl +++ b/src/SimpleGraphs/SimpleGraphs.jl @@ -73,7 +73,7 @@ function rem_edge!(g::AbstractSimpleGraph{T}, u::Integer, v::Integer) where T rem_edge!(g, edgetype(g)(T(u), T(v))) end -@doc_str """ +""" rem_vertex!(g, v) Remove the vertex `v` from graph `g`. Return false if removal fails diff --git a/src/biconnectivity/biconnect.jl b/src/biconnectivity/biconnect.jl index b8c370590..bab4b4c64 100644 --- a/src/biconnectivity/biconnect.jl +++ b/src/biconnectivity/biconnect.jl @@ -53,7 +53,7 @@ function visit!(g::AbstractGraph, state::Biconnections, u::Integer, v::Integer) end end -@doc_str """ +""" biconnected_components(g) Compute the [biconnected components](https://en.wikipedia.org/wiki/Biconnected_component) diff --git a/src/centrality/betweenness.jl b/src/centrality/betweenness.jl index bfe554c6e..6823c91ae 100644 --- a/src/centrality/betweenness.jl +++ b/src/centrality/betweenness.jl @@ -2,7 +2,7 @@ # TODO - weighted, separate unweighted, edge betweenness -@doc_str """ +""" betweenness_centrality(g[, vs]) betweenness_centrality(g, k) parallel_betweenness_centrality(g[, vs]) diff --git a/src/centrality/closeness.jl b/src/centrality/closeness.jl index 4032cba80..d4ea76cea 100644 --- a/src/centrality/closeness.jl +++ b/src/centrality/closeness.jl @@ -1,4 +1,4 @@ -@doc_str """ +""" closeness_centrality(g) Calculate the [closeness centrality](https://en.wikipedia.org/wiki/Centrality#Closeness_centrality) diff --git a/src/community/clustering.jl b/src/community/clustering.jl index f950825c4..0051fe83b 100644 --- a/src/community/clustering.jl +++ b/src/community/clustering.jl @@ -46,7 +46,7 @@ function local_clustering!(storage::AbstractVector{Bool}, return ntriang, nalltriang end -@doc_str """ +""" local_clustering(g, v) local_clustering(g, vs) diff --git a/src/core.jl b/src/core.jl index c827876dd..d9468c7c9 100644 --- a/src/core.jl +++ b/src/core.jl @@ -183,7 +183,7 @@ Return the number of self loops in `g`. """ num_self_loops(g::AbstractGraph) = nv(g) == 0 ? 0 : sum(v -> has_edge(g, v, v), vertices(g)) -@doc_str """ +""" density(g) Return the density of `g`. Density is defined as the ratio of the number of actual edges to the diff --git a/src/digraph/cycles/johnson.jl b/src/digraph/cycles/johnson.jl index 188450d92..4cfdaebf8 100644 --- a/src/digraph/cycles/johnson.jl +++ b/src/digraph/cycles/johnson.jl @@ -22,7 +22,7 @@ The formula is coming from [Johnson, 1973](Johnson). maxsimplecycles(n::Integer) = sum(x -> ncycles_n_i(n, x), 1:(n - 1)) -@doc_str """ +""" maxsimplecycles(dg::::IsDirected, byscc::Bool = true) Compute the theoretical maximum number of cycles in the directed graph `dg`. @@ -102,7 +102,7 @@ function unblock!(v::T, blocked::BitArray, B::Vector{Set{T}}) where T<:Integer end end -@doc_str """ +""" circuit{T<:Integer}(v::T, dg::::IsDirected, vis::JohnsonVisitor{T}, allcycles::Vector{Vector{T}}, vmap::Vector{T}, startnode::T = v) @@ -154,7 +154,7 @@ allcycles::Vector{Vector{T}}, vmap::Vector{T}, startnode::T = v) where T<:Intege end -@doc_str """ +""" simplecycles(dg::::IsDirected) Compute all cycles of the given directed graph, using @@ -186,7 +186,7 @@ end ########################################################## #### Iterative version, using Tasks, of the previous algorithms. -@doc_str """ +""" circuit_iter{T<:Integer}(v::T, dg::::IsDirected, vis::JohnsonVisitor{T}, vmap::Vector{T}, cycle::Channel, startnode::T = v) @@ -267,7 +267,7 @@ function itercycles end end end -@doc_str """ +""" simplecyclescount(dg::DiGraph, ceiling = 10^6) Count the number of cycles in a directed graph, using @@ -292,7 +292,7 @@ function simplecyclescount end return len end -@doc_str """ +""" simplecycles_iter(dg::DiGraph, ceiling = 10^6) Search all cycles of the given directed graph, using @@ -314,7 +314,7 @@ function simplecycles_iter end @traitfn simplecycles_iter(dg::::IsDirected, ceiling = 10^6) = collect(Iterators.take(Channel(c -> itercycles(dg, c)), ceiling)) -@doc_str """ +""" simplecycleslength(dg::DiGraph, ceiling = 10^6) Search all cycles of the given directed graph, using diff --git a/src/digraph/transitivity.jl b/src/digraph/transitivity.jl index 1a12641cb..bd44a052d 100644 --- a/src/digraph/transitivity.jl +++ b/src/digraph/transitivity.jl @@ -1,4 +1,4 @@ -@doc_str """ +""" transitiveclosure!(g, selflooped=false) Compute the transitive closure of a directed graph, using the Floyd-Warshall diff --git a/src/edit_distance.jl b/src/edit_distance.jl index 793245a8e..343775758 100644 --- a/src/edit_distance.jl +++ b/src/edit_distance.jl @@ -1,4 +1,4 @@ -@doc_str """ +""" edit_distance(G₁::AbstractGraph, G₂::AbstractGraph) Compute the edit distance between graphs `G₁` and `G₂`. Return the minimum diff --git a/src/generators/euclideangraphs.jl b/src/generators/euclideangraphs.jl index ec32071a1..67df4d224 100644 --- a/src/generators/euclideangraphs.jl +++ b/src/generators/euclideangraphs.jl @@ -1,4 +1,4 @@ -@doc_str """ +""" euclidean_graph(N, d; seed=-1, L=1., p=2., cutoff=-1., bc=:open) Generate `N` uniformly distributed points in the box ``[0,L]^{d}`` diff --git a/src/generators/randgraphs.jl b/src/generators/randgraphs.jl index 2862541ca..a306464d7 100644 --- a/src/generators/randgraphs.jl +++ b/src/generators/randgraphs.jl @@ -357,7 +357,7 @@ function barabasi_albert!(g::AbstractGraph, n::Integer, k::Integer; seed::Int=-1 end -@doc_str """ +""" static_fitness_model(m, fitness) Generate a random graph with ``|fitness|`` vertices and `m` edges, @@ -393,7 +393,7 @@ function static_fitness_model(m::Integer, fitness::Vector{T}; seed::Int=-1) wher return g end -@doc_str """ +""" static_fitness_model(m, fitness_out, fitness_in) Generate a random graph with ``|fitness\\_out + fitness\\_in|`` vertices and `m` edges, @@ -449,7 +449,7 @@ function _create_static_fitness_graph!(g::AbstractGraph, m::Integer, cum_fitness end end -@doc_str """ +""" static_scale_free(n, m, α) Generate a random graph with `n` vertices, `m` edges and expected power-law @@ -475,7 +475,7 @@ function static_scale_free(n::Integer, m::Integer, α::Real; seed::Int=-1, finit static_fitness_model(m, fitness, seed=seed) end -@doc_str """ +""" static_scale_free(n, m, α_out, α_in) Generate a random graph with `n` vertices, `m` edges and expected power-law @@ -523,7 +523,7 @@ function _construct_fitness(n::Integer, α::Real, finite_size_correction::Bool) return fitness end -@doc_str """ +""" random_regular_graph(n, k) Create a random undirected @@ -565,7 +565,7 @@ function random_regular_graph(n::Integer, k::Integer; seed::Int=-1) return g end -@doc_str """ +""" random_configuration_model(n, ks) Create a random undirected graph according to the [configuration model] @@ -605,7 +605,7 @@ function random_configuration_model(n::Integer, k::Array{T}; seed::Int=-1, check return g end -@doc_str """ +""" random_regular_digraph(n, k) Create a random directed [regular graph](https://en.wikipedia.org/wiki/Regular_graph) @@ -649,7 +649,7 @@ function random_regular_digraph(n::Integer, k::Integer; dir::Symbol=:out, seed:: end end -@doc_str """ +""" random_tournament_digraph(n) Create a random directed [tournament graph] @@ -671,7 +671,7 @@ function random_tournament_digraph(n::Integer; seed::Int=-1) return g end -@doc_str """ +""" stochastic_block_model(c, n) Return a Graph generated according to the Stochastic Block Model (SBM). @@ -722,7 +722,7 @@ function stochastic_block_model(c::Matrix{T}, n::Vector{U}; seed::Int = -1) wher return g end -@doc_str """ +""" stochastic_block_model(cint, cext, n) Return a Graph generated according to the Stochastic Block Model (SBM), sampling @@ -813,7 +813,7 @@ end const biclique = ones(2, 2) - eye(2) #TODO: this documentation needs work. sbromberger 20170326 -@doc_str """ +""" nearbipartiteaffinity(sizes, between, intra) Construct the affinity matrix for a near bipartite SBM. diff --git a/src/generators/smallgraphs.jl b/src/generators/smallgraphs.jl index bd99ed356..4561347d7 100644 --- a/src/generators/smallgraphs.jl +++ b/src/generators/smallgraphs.jl @@ -18,7 +18,7 @@ function _make_simple_directed_graph(n::T, edgelist::Vector{Tuple{T,T}}) where T return g end -doc""" +""" smallgraph(s) smallgraph(s) diff --git a/src/generators/staticgraphs.jl b/src/generators/staticgraphs.jl index 1fb0e9643..8bbe1ffd1 100644 --- a/src/generators/staticgraphs.jl +++ b/src/generators/staticgraphs.jl @@ -18,7 +18,7 @@ function CompleteGraph(n::Integer) end -@doc_str """ +""" CompleteBipartiteGraph(n1, n2) Create an undirected [complete bipartite graph](https://en.wikipedia.org/wiki/Complete_bipartite_graph) @@ -169,7 +169,7 @@ function WheelDiGraph(n::Integer) return g end -@doc_str """ +""" Grid(dims; periodic=false) Create a ``|dims|``-dimensional cubic lattice, with length `dims[i]` diff --git a/src/linalg/graphmatrices.jl b/src/linalg/graphmatrices.jl index f93b86590..8595e2fa9 100644 --- a/src/linalg/graphmatrices.jl +++ b/src/linalg/graphmatrices.jl @@ -40,7 +40,7 @@ function CombinatorialAdjacency(A::SparseMatrix{T}) where T end -@doc_str """ +""" NormalizedAdjacency{T} The normalized adjacency matrix is ``\\hat{A} = D^{-1/2} A D^{-1/2}``. @@ -133,7 +133,7 @@ struct CombinatorialLaplacian{T} <: Laplacian{T} A::CombinatorialAdjacency{T} end -@doc_str """ +""" NormalizedLaplacian{T} The normalized Laplacian is ``\\hat{L} = I - D^{-1/2} A D^{-1/2}``. diff --git a/src/linalg/nonbacktracking.jl b/src/linalg/nonbacktracking.jl index 84004f784..943ca2733 100644 --- a/src/linalg/nonbacktracking.jl +++ b/src/linalg/nonbacktracking.jl @@ -1,5 +1,5 @@ -@doc_str """ +""" non_backtracking_matrix(g) Return a non-backtracking matrix `B` and an edgemap storing the oriented @@ -40,7 +40,7 @@ function non_backtracking_matrix(g::AbstractGraph) return B, edgeidmap end -@doc_str """ +""" Nonbacktracking{G} A compact representation of the nonbacktracking operator. diff --git a/src/linalg/spectral.jl b/src/linalg/spectral.jl index 7374ead64..6b8c62b21 100644 --- a/src/linalg/spectral.jl +++ b/src/linalg/spectral.jl @@ -84,7 +84,7 @@ function laplacian_matrix(g::AbstractGraph{U}, T::DataType=Int; dir::Symbol=:uns return D - A end -@doc_str """ +""" laplacian_spectrum(g[, T=Int; dir=:unspec]) Return the eigenvalues of the Laplacian matrix for a graph `g`, indexed @@ -103,7 +103,7 @@ eigenvalues/eigenvectors. """ laplacian_spectrum(g::AbstractGraph, T::DataType=Int; dir::Symbol=:unspec) = eigvals(Matrix(laplacian_matrix(g, T; dir=dir))) -@doc_str """ +""" Return the eigenvalues of the adjacency matrix for a graph `g`, indexed by vertex. Default values for `T` are the same as those in [`adjacency_matrix`](@ref). @@ -166,7 +166,7 @@ function incidence_matrix(g::AbstractGraph, T::DataType=Int; oriented=false) return spmx end -@doc_str """ +""" spectral_distance(G₁, G₂ [, k]) Compute the spectral distance between undirected n-vertex diff --git a/src/operators.jl b/src/operators.jl index 832b41547..e4bcff405 100644 --- a/src/operators.jl +++ b/src/operators.jl @@ -62,7 +62,7 @@ function reverse! end return g end -doc""" +""" blkdiag(g, h) Return a graph with ``|V(g)| + |V(h)|`` vertices and ``|E(g)| + |E(h)|`` diff --git a/src/shortestpaths/dijkstra.jl b/src/shortestpaths/dijkstra.jl index 86b9f3302..7086a4214 100644 --- a/src/shortestpaths/dijkstra.jl +++ b/src/shortestpaths/dijkstra.jl @@ -119,7 +119,7 @@ struct MultipleDijkstraState{T<:Real,U<:Integer} <: AbstractPathState parents::Matrix{U} end -@doc_str """ +""" parallel_multisource_dijkstra_shortest_paths(g, sources=vertices(g), distmx=weights(g)) Compute the shortest paths between all pairs of vertices in graph `g` by running diff --git a/src/shortestpaths/floyd-warshall.jl b/src/shortestpaths/floyd-warshall.jl index fa845ba29..f66e3221b 100644 --- a/src/shortestpaths/floyd-warshall.jl +++ b/src/shortestpaths/floyd-warshall.jl @@ -12,7 +12,7 @@ struct FloydWarshallState{T,U<:Integer} <: AbstractPathState parents::Matrix{U} end -@doc_str """ +""" floyd_warshall_shortest_paths(g, distmx=weights(g)) Use the [Floyd-Warshall algorithm](http://en.wikipedia.org/wiki/Floyd–Warshall_algorithm) to compute the shortest paths between all pairs of vertices in graph `g` using an diff --git a/src/traversals/greedy_color.jl b/src/traversals/greedy_color.jl index ca130d89e..76cf46b92 100644 --- a/src/traversals/greedy_color.jl +++ b/src/traversals/greedy_color.jl @@ -108,7 +108,7 @@ If parallel is true then the colorings are executed in parallel. random_greedy_color(g::AbstractGraph{T}, reps::Integer = 1, parallel::Bool = false) where {T<:Integer} = parallel ? parallel_random_greedy_color(g, reps) : seq_random_greedy_color(g, reps) -@doc_str """ +""" greedy_color(g; sort_degree=false, parallel=false, reps = 1) Color graph `g` based on [Greedy Coloring Heuristics](https://en.wikipedia.org/wiki/Greedy_coloring) diff --git a/test/runtests.jl b/test/runtests.jl index ce05d4319..74381fb3a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,6 +4,7 @@ using Test using SparseArrays using LinearAlgebra using DelimitedFiles +using Base64 const testdir = dirname(@__FILE__)