Skip to content

Commit

Permalink
Merge branch 'master' into pr/simonschoelly/278
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalle committed Sep 14, 2023
2 parents cbd6c7a + d25e5d7 commit c3a46ab
Show file tree
Hide file tree
Showing 24 changed files with 432 additions and 140 deletions.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---
96 changes: 58 additions & 38 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.9.0-rc2"
julia_version = "1.9.3"
manifest_format = "2.0"
project_hash = "4fb688147559360c201b0f727fe4bd07d6143f40"
project_hash = "f938aa9ae045c73618c84d5b3b75f85a7cb9262d"

[[deps.ANSIColoredPrinters]]
git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
version = "0.0.1"

[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
Expand All @@ -21,21 +26,25 @@ uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[deps.Compat]]
deps = ["Dates", "LinearAlgebra", "UUIDs"]
git-tree-sha1 = "aaabba4ce1b7f8a9b34c015053d3b1edf60fa49c"
deps = ["UUIDs"]
git-tree-sha1 = "e460f044ca8b99be31d35fe54fc33a5c33dd8ed7"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "4.4.0"
version = "4.9.0"
weakdeps = ["Dates", "LinearAlgebra"]

[deps.Compat.extensions]
CompatLinearAlgebraExt = "LinearAlgebra"

[[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.0.2+0"
version = "1.0.5+0"

[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "d1fff3a548102f48987a52a2e0d114fa97d730f0"
git-tree-sha1 = "3dbd312d370723b6bb43ba9d02fc36abade4518d"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.13"
version = "0.18.15"

[[deps.Dates]]
deps = ["Printf"]
Expand All @@ -47,15 +56,15 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[deps.DocStringExtensions]]
deps = ["LibGit2"]
git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b"
git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.6"
version = "0.9.3"

[[deps.Documenter]]
deps = ["Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
git-tree-sha1 = "3ebb967819b284dc1e3c0422229b58a40a255649"
deps = ["ANSIColoredPrinters", "Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
git-tree-sha1 = "39fd748a73dce4c05a9655475e437170d8fb1b67"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "0.26.3"
version = "0.27.25"

[[deps.Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
Expand All @@ -67,15 +76,15 @@ uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"

[[deps.Graphs]]
deps = ["ArnoldiMethod", "Compat", "DataStructures", "Distributed", "Inflate", "LinearAlgebra", "Random", "SharedArrays", "SimpleTraits", "SparseArrays", "Statistics"]
path = ".."
path = "/home/hyrodium/.julia/dev/Graphs"
uuid = "86223c79-3864-5bf0-83f7-82e725a168b6"
version = "1.8.0"

[[deps.IOCapture]]
deps = ["Logging"]
git-tree-sha1 = "377252859f740c217b936cebcd918a44f9b53b59"
deps = ["Logging", "Random"]
git-tree-sha1 = "d75853a0bdbfb1ac815478bacd89cd27b550ace6"
uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
version = "0.1.1"
version = "0.2.3"

[[deps.Inflate]]
git-tree-sha1 = "5cd07aab533df5170988219191dfad0519391428"
Expand All @@ -88,9 +97,9 @@ uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "3c837543ddb02250ef42f4738347454f95079d4e"
git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.3"
version = "0.21.4"

[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
Expand Down Expand Up @@ -123,9 +132,9 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[deps.MacroTools]]
deps = ["Markdown", "Random"]
git-tree-sha1 = "42324d08725e200c23d4dfb549e0d5d89dede2d2"
git-tree-sha1 = "9ee1618cbf5240e6d4e0371d6f24065083f60c48"
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
version = "0.5.10"
version = "0.5.11"

[[deps.Markdown]]
deps = ["Base64"]
Expand Down Expand Up @@ -153,20 +162,32 @@ uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
version = "0.3.21+4"

[[deps.OrderedCollections]]
git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c"
git-tree-sha1 = "2e73fe17cac3c62ad1aebe70d44c963c3cfdc3e3"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.4.1"
version = "1.6.2"

[[deps.Parsers]]
deps = ["Dates", "SnoopPrecompile"]
git-tree-sha1 = "b64719e8b4504983c7fca6cc9db3ebc8acc2a4d6"
deps = ["Dates", "PrecompileTools", "UUIDs"]
git-tree-sha1 = "716e24b21538abc91f6205fd1d8363f39b442851"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.5.1"
version = "2.7.2"

[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
version = "1.9.0"
version = "1.9.2"

[[deps.PrecompileTools]]
deps = ["Preferences"]
git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f"
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
version = "1.2.0"

[[deps.Preferences]]
deps = ["TOML"]
git-tree-sha1 = "7eb1686b4f04b82f96ed7a4ea5890a4f0c7a09f1"
uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.4.0"

[[deps.Printf]]
deps = ["Unicode"]
Expand Down Expand Up @@ -197,11 +218,6 @@ git-tree-sha1 = "5d7e3f4e11935503d3ecaf7186eac40602e7d231"
uuid = "699a6c99-e7fa-54fc-8d76-47d257e15c1d"
version = "0.9.4"

[[deps.SnoopPrecompile]]
git-tree-sha1 = "f604441450a3c0569830946e5b33b78c928e1a85"
uuid = "66db9d55-30c0-4569-8b51-7e840670fc0c"
version = "1.0.1"

[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

Expand All @@ -210,15 +226,19 @@ deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[[deps.StaticArrays]]
deps = ["LinearAlgebra", "Random", "StaticArraysCore", "Statistics"]
git-tree-sha1 = "4e051b85454b4e4f66e6a6b7bdc452ad9da3dcf6"
deps = ["LinearAlgebra", "Random", "StaticArraysCore"]
git-tree-sha1 = "9cabadf6e7cd2349b6cf49f1915ad2028d65e881"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.5.10"
version = "1.6.2"
weakdeps = ["Statistics"]

[deps.StaticArrays.extensions]
StaticArraysStatisticsExt = "Statistics"

[[deps.StaticArraysCore]]
git-tree-sha1 = "6b7ba252635a5eff6a0b0664a41ee140a1c9e72a"
git-tree-sha1 = "36b3d696ce6366023a0ea192b4cd442268995a0d"
uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
version = "1.4.0"
version = "1.4.2"

[[deps.Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
Expand Down Expand Up @@ -259,7 +279,7 @@ version = "1.2.13+0"
[[deps.libblastrampoline_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
version = "5.4.0+0"
version = "5.8.0+0"

[[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"

[compat]
Documenter = "~0.26.2"
Documenter = "~0.27"
1 change: 1 addition & 0 deletions docs/src/algorithms/traversals.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ Pages = [
"traversals/greedy_color.jl",
"traversals/maxadjvisit.jl",
"traversals/randomwalks.jl",
"traversals/eulerian.jl",
]
```
2 changes: 1 addition & 1 deletion docs/src/first_steps/plotting.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ SGtSNEpi.jl enables 3D graph embedding as well. The 3D embedding of the weighted

## [GraphRecipes.jl](https://github.com/JuliaPlots/GraphRecipes.jl)

GraphRecipes.jl contains several recipes for plotting networks using the Plots.jl ecosystem. There are a lot of different recipes and styles to choose from, check out the [examples page](http://docs.juliaplots.org/latest/graphrecipes/examples/) to see more of them.
GraphRecipes.jl contains several recipes for plotting networks using the Plots.jl ecosystem. There are a lot of different recipes and styles to choose from, check out the [examples page](https://docs.juliaplots.org/stable/GraphRecipes/examples/) to see more of them.

```julia
using Plots, GraphRecipes
Expand Down
4 changes: 4 additions & 0 deletions src/Graphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ export
diffusion,
diffusion_rate,

# eulerian
eulerian,

# coloring
greedy_color,

Expand Down Expand Up @@ -488,6 +491,7 @@ include("traversals/dfs.jl")
include("traversals/maxadjvisit.jl")
include("traversals/randomwalks.jl")
include("traversals/diffusion.jl")
include("traversals/eulerian.jl")
include("connectivity.jl")
include("distance.jl")
include("editdist.jl")
Expand Down
10 changes: 9 additions & 1 deletion src/Test/Test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ struct GenericGraph{T} <: Graphs.AbstractGraph{T}
g::SimpleGraph{T}
end

function GenericGraph(elist::Vector{Graphs.SimpleGraphEdge{T}}) where {T<:Integer}
return GenericGraph{T}(SimpleGraph(elist))
end

"""
GenericDiGraph{T} <: Graphs.AbstractGraph{T}
Expand All @@ -51,11 +55,15 @@ end
Return either a GenericGraph or GenericDiGraph that wraps a copy of g.
"""
function generic_graph(g::Union{SimpleGraph, SimpleDiGraph})
function generic_graph(g::Union{SimpleGraph,SimpleDiGraph})
g = copy(g)
return is_directed(g) ? GenericDiGraph(g) : GenericGraph(g)
end

function GenericDiGraph(elist::Vector{Graphs.SimpleDiGraphEdge{T}}) where {T<:Integer}
return GenericDiGraph{T}(SimpleDiGraph(elist))
end

Graphs.is_directed(::Type{<:GenericGraph}) = false
Graphs.is_directed(::Type{<:GenericDiGraph}) = true

Expand Down
4 changes: 2 additions & 2 deletions src/community/clustering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ end
function local_clustering!(storage::AbstractVector{Bool}, g::AbstractGraph, v::Integer)
k = degree(g, v)
k <= 1 && return (0, 0)
neighs = neighbors(g, v)
neighs = collect_if_not_vector(neighbors(g, v))
tcount = 0
storage[neighs] .= true

Expand All @@ -63,7 +63,7 @@ function local_clustering!(
i = 0
for (i, v) in enumerate(vs)
ntriang[i], nalltriang[i] = local_clustering!(storage, g, v)
storage[neighbors(g, v)] .= false
storage[collect_if_not_vector(neighbors(g, v))] .= false
end
return ntriang, nalltriang
end
Expand Down
26 changes: 19 additions & 7 deletions src/traversals/bfs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@ end
function _bfs_parents(g::AbstractGraph{T}, source, neighborfn::Function) where {T}
n = nv(g)
visited = falses(n)
parents = zeros(T, nv(g))
parents = zeros(T, n)
cur_level = Vector{T}()
sizehint!(cur_level, n)
next_level = Vector{T}()
sizehint!(next_level, n)
k = 0
@inbounds for s in source
visited[s] = true
push!(cur_level, s)
parents[s] = s
if !visited[s]
visited[s] = true
push!(cur_level, s)
parents[s] = s
k += 1
end
end
while !isempty(cur_level)
@inbounds for v in cur_level
Expand All @@ -64,8 +68,10 @@ function _bfs_parents(g::AbstractGraph{T}, source, neighborfn::Function) where {
push!(next_level, i)
parents[i] = v
visited[i] = true
k += 1
end
end
k == n && return parents
end
empty!(cur_level)
cur_level, next_level = next_level, cur_level
Expand Down Expand Up @@ -109,10 +115,14 @@ function gdistances!(g::AbstractGraph{T}, source, vert_level; sort_alg=QuickSort
sizehint!(cur_level, n)
next_level = Vector{T}()
sizehint!(next_level, n)
k = 0
@inbounds for s in source
vert_level[s] = zero(T)
visited[s] = true
push!(cur_level, s)
if !visited[s]
vert_level[s] = zero(T)
visited[s] = true
push!(cur_level, s)
k += 1
end
end
while !isempty(cur_level)
@inbounds for v in cur_level
Expand All @@ -121,8 +131,10 @@ function gdistances!(g::AbstractGraph{T}, source, vert_level; sort_alg=QuickSort
push!(next_level, i)
vert_level[i] = n_level
visited[i] = true
k += 1
end
end
k == n && return vert_level
end
n_level += one(T)
empty!(cur_level)
Expand Down
Loading

0 comments on commit c3a46ab

Please sign in to comment.