Skip to content

Instantly share code, notes, and snippets.

@miguelraz
Created May 31, 2018 17:13
Show Gist options
  • Save miguelraz/92ec4fc43bfd9adff1b51dc6f37345d7 to your computer and use it in GitHub Desktop.
Save miguelraz/92ec4fc43bfd9adff1b51dc6f37345d7 to your computer and use it in GitHub Desktop.
# Credit to Kristoffer Carlsson
cd("/Users/kristoffer/julia/stdlib")
import TOML
using LightGraphs
import TikzGraphs
const STDLIB_DIR = "."
const STDLIBS = readdir(STDLIB_DIR)
deps = Dict{String, Int}()
for (i, stdlib) in enumerate(STDLIBS)
deps[stdlib] = i
end
g = LightGraphs.SimpleGraphs.SimpleDiGraph(length(STDLIBS))
for (i, stdlib) in enumerate(STDLIBS)
proj = TOML.parsefile(joinpath(STDLIB_DIR, stdlib, "Project.toml"))
if haskey(proj, "deps")
for (stdlib_dep, uuid) in proj["deps"]
add_edge!(g, deps[stdlib], deps[stdlib_dep])
end
end
end
t = TikzGraphs.plot(g, Layouts.SimpleNecklace(), STDLIBS)
TikzPictures.save(SVG("graph"), t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment