Created
May 31, 2018 17:13
-
-
Save miguelraz/92ec4fc43bfd9adff1b51dc6f37345d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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