Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JuliaGraphs_interop: try w/o MetaGraphsNext #35

Closed
tfiers opened this issue Dec 28, 2022 · 3 comments
Closed

JuliaGraphs_interop: try w/o MetaGraphsNext #35

tfiers opened this issue Dec 28, 2022 · 3 comments

Comments

@tfiers
Copy link
Owner

tfiers commented Dec 28, 2022

that g[Symbol(a), Symbol(b)] = nothing interface is kinda ew

@tfiers
Copy link
Owner Author

tfiers commented Dec 28, 2022

It's not much extra load though:

julia> @time using MetaGraphsNext
  1.951201 seconds (3.44 M allocations: 247.719 MiB, 1.53% gc time, 0.91% compilation time: 12% of which was recompilation)
julia> @time using Graphs
  1.501878 seconds (2.36 M allocations: 175.148 MiB)

@tfiers
Copy link
Owner Author

tfiers commented Dec 28, 2022

https://juliagraphs.org/Graphs.jl/dev/first_steps/construction/
so sth like

g = DiGraph()

# option 1
node_IDs = Dict(pkg => i for (i,pkg) in enumerate(packages))
node(pkg) = node_IDs[pkg]

# option 2
node(pkg) = findfirst(packages, pkg)

for (pkg, dep) in edges
    add_edge!(g, node(pkg), node(dep))
end


for i in vertices(g)
	pkg = packages[i]
	

This is as clean (if not cleaner) and we spare a dep (0.45 second import time on computer; that's more on gh actions)

@tfiers
Copy link
Owner Author

tfiers commented Dec 28, 2022

(I don't get the point of MetaGraphs; if you can't even do outdegree(g, :Test) (but have to instead do outdegree(g, code_for(g, :Test)). That's literally the same)

@tfiers tfiers closed this as completed in a1e6bd5 Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant