Hello there,
I am having a seemingly recurring issue here.
Lets say I am working on a Julia file with graphs for a while and everything is going well. Then I close that file and don’t use it for ages, and then the next time I come back, I get this error related to the Graphs package. Every single time. I don’t know what is causing this, please help.
It has become very frustrating as my work uses network graphs ALOT.
I suspect it’s something I am doing.
But here is the error message I get:
MethodError: no method matching layout(::Spring{2, Float64}, ::SimpleDiGraph{Int64})
Closest candidates are:
layout(::NetworkLayout.IterativeLayout, ::AbstractMatrix) at \NetworkLayout.jl:75
layout(::NetworkLayout.AbstractLayout, ::LightGraphs.AbstractGraph)
Here is a snippet of my code to better explain
import Cairo,Fontconfig
using Random, Graphs, GraphMakie, GLMakie, CairoMakie, DataFrames, DelimitedFiles, Distributions, MetaGraphs
using GraphMakie.NetworkLayout
CairoMakie.activate!()
Random.seed!(2409);
system_data = readdlm("PrPm/16 NodeNetwork Adjacency matrix.csv", ',', header= false, Int);
system_matrix = Matrix(DataFrame(system_data, :auto));
system_graph= DiGraph(system_matrix)
Sources=[1,3,13]; link_reliability=0.9; Node_Priors = 1 #no node failure therefore node reliability = 1
f, ax, p = graphplot(system_graph, #layout=SquareGrid(),
arrow_size=[25 for i in 1:ne(system_graph)],
nlabels= repr.(1:nv(system_graph)),
node_color=[if i in Sources "blue" else "pink" end for i in 1:nv(system_graph) ], #Use colours to identify sink vs source nodes
node_size=[20 for i in 1:nv(system_graph) ])
ax.yreversed = true
hidedecorations!(ax) # hides ticks, grid and lables
hidespines!(ax) # hide the frame
display(f)
What I have tried:
- Running my code line by line to figure out where problem is. I believe the problem line to be: graph plot line here:
f, ax, p = graphplot(system_graph, #layout=SquareGrid(),
- Killing and restarting julia REPL
- Updating Graphs package in package manager
4.Restarting everything