-
Notifications
You must be signed in to change notification settings - Fork 0
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
json exporting #82
Comments
More thoughts: One could ask if this functionality should be in the package or somewhere else. The package is now kind of clean in terms of what it can/should do (in the same sense that BLAS and LAPACK are clean). Adding visualizations is yet another feature... On the other hand, generate json seems to be not so much code and focused on the data structure rather than visualization, so if we can restrict it to json-generation (not javascript generation) it is maybe still okay. |
As an intermediate step, I suggest we add the functionality to compute the adjacency matrix. The standardized way for the function is Something like: function adjecency_matrix(g)
(nodes,_)=get_topo_order(g)
# Include the basic fundamental nodes
pushfirst!(nodes,:I)
pushfirst!(nodes,:A)
m=size(nodes,1);
A=zeros(m,m);
for (i,n) in enumerate(nodes)
children=GraphMatFun.get_children(g,n)
children_idx=map(i-> findfirst(nodes .== i), children);
# Set all children to value 1.
A[i,children_idx] .= 1;
end
# A will be a sparse non-symmetric matrix with ones and zeros
return A;
end Then we can directly use graphplots julia> using GraphRecipes, Plots
julia> (g,_)=graph_sastre_poly([randn(8);1])
julia> A=adjecency_matrix(g);
julia> graphplot(A, names=["I"; "A"; string.(get_topo_order(g)[1])]) |
For presenting and visualization of our work, it would be cool to generate 3d-force-graphs of the computation graphs using
https://github.com/vasturiano/3d-force-graph/
We need
a) functionality to export the computation graph to a json format. This could either be a separate function 1)
export_json
or 2) a part ofgen_code
withLangJSON
. At the moment I would say option 1) since it would not need the memory management functionality.b) some javascript that reads the json and encodes operations / coefficients etc graphically in the 3d-force-graph format wanted in that library
Point a) should be rather straightforward if we add dependence
JSON.jl
following this:Javascript examples:
https://people.kth.se/~eliasj/watkins-graph-small.html
https://people.kth.se/~eliasj/large-graph.html
The text was updated successfully, but these errors were encountered: