Skip to content

Instantly share code, notes, and snippets.

@abhijithanilkumar
Created July 8, 2016 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhijithanilkumar/c705231bc53e49ed8a38cf2fb85499ca to your computer and use it in GitHub Desktop.
Save abhijithanilkumar/c705231bc53e49ed8a38cf2fb85499ca to your computer and use it in GitHub Desktop.
using LightGraphs
using NetworkViz
using NetworkLayout
using ThreeJS
using Colors
main(window) = begin
"""ar = int(open(readdlm,"jagmesh1.mtx"))
x = ar[:,1]
y = ar[:,2]
z = [1 for i in 1:3600]
am = sparse(x,y,z)"""
node=NodeProperty(Color[parse(Colorant,"#00004d") for i in 1:30],0.5,1)
edge=EdgeProperty("#ff3333",2)
g = WheelGraph(30)
am = full(adjacency_matrix(g))
#loc_x, loc_y = layout_fdp(am,tol=0.01,C=0.2,K=2)
#loc_z = zeros(size(am))
new = layout_fdp(am,2,tol=0.01,C=0.2,K=2)
loc_x = Float64[new[i][1] for i in 1:30]
loc_y = Float64[new[i][2] for i in 1:30]
#loc_z = Float64[new[i][3] for i in 1:936]
loc_z = zeros(size(am))
pts = zip(loc_x,loc_y,loc_z,node.color)
vertices = find_edges(loc_x, loc_y, full(am))
push!(window.assets,("ThreeJS","threejs"))
push!(window.assets,"widgets")
vbox(
vskip(2em),
plot(collect(pts),vertices, node, edge)
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment