-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acf7f35
commit 164884b
Showing
3 changed files
with
28 additions
and
22 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
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 |