Skip to content

Commit

Permalink
plot solutions cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
harshangrjn committed Jan 18, 2024
1 parent acf7f35 commit 164884b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LaplacianOpt.jl Change Log
- Fixed Docs compile issue
- Updated 100 and 60 nodes instances with solutions
- Minor updates in graphviz logging in `log.jl`
- `plot_solutions.jl` script added to plot graphs

### v0.6.0
- Added mutiple heuristics to handle both spanning trees and graphs with loops
Expand Down
22 changes: 0 additions & 22 deletions examples/plot_solutions.jl

This file was deleted.

27 changes: 27 additions & 0 deletions examples/solutions/plot_solutions.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Script to plot graphs of various nodes solutions in this folder

using JSON
import LaplacianOpt as LOpt

num_nodes = 25
instance = 2

filename = joinpath(@__DIR__, "$(num_nodes)_nodes/$(num_nodes)_$(instance).json")

open(filename) do f
json_str = read(f, String)
dict = JSON.parse(json_str)

adjacency_matrix = zeros(num_nodes, num_nodes)
for k in keys(dict["graph_adjacency"])
e = dict["graph_adjacency"][k]
adjacency_matrix[e[1], e[2]] = 1
adjacency_matrix[e[2], e[1]] = 1
end

return LOpt.plot_graphviz(
adjacency_matrix,
display_edge_weights = false,
edge_length = 0.5,
)
end

0 comments on commit 164884b

Please sign in to comment.