Graphs, GraphPlot

could someone please help?

I’m new to the Graphs package and I want to plot a graph (as described by the GraphPlot github documentation)

using Graphs: smallgraph
g = smallgraph(:karate)

My problem is that the output is not a plotted graph but only text beginning with

"Compose.Context(Measures.BoundingBox …

Plots with the Plots.jl package are displayed as expected.

What am I doing wrong?

It’s difficult to say what’s going wrong without knowing a bit more about which versions of various packages and environments you’re running. On my VSCode with Julia v1.8, I see:

with these versions:

 pkg> st
Status `~/.julia/environments/Temp/Project.toml`
  [a2cc645c] GraphPlot v0.5.2
  [86223c79] Graphs v1.7.4

The problem here is that gplot returns a Compose.Context fromCompose.jl but there is no handler installed in the Julia REPL that would know how to draw that kind of object, so you only see text. Apparently there is in VSCode.

What you can do instead is to use gplothtml(g) that will show your graph in a browser window.

We should probably add such information to the README file, but development on that package is currently slow because of a lack of time.

As an alternative you could also give GraphMakie.jl a try.


Curiously, for some reason I managed to get GraphPlot v0.5.2 downloaded, although the github page shows the latest version as v0.4.4.

Probably something wrong with tagbot so that there was never a release entry on Github. These released are independent of the ones published in the general registry.

Thank you very much for your answer and detailed information.

Sorry for not mentioning it. You are right, I use Julia REPL with following installed packages:

GraphPlot v0.5.2
Graphs v1.7.4

I’ve tried gplothtml(g) but unfortunately encountered the same issue as reported in gplothtml not working #175

After installing the GraphMakie package the graph is successfully displayed.

Thanks again for your support and your great work and contribution to the JuliaGraphs development