1
votes

I am currently in the process of plotting a directed graphs using Julia. After some time on the internet I came across the GraphPLot package which seems to be doing an ok job.

However, I can't find out how to add node labels! Here is my code and output from the jupyter notebook.

Update: I tried the suggested method from GitHub

nodelabel = [1:number_vertices(g)] gplot(g, nodelabel = nodelabel)

But I get a weird error:

LoadError: Must have one label per node (or none) while loading In[44], in expression starting on line 1

1
Your nodelabel has the wrong format. Try nodelabel = 1:number_vertices(g) or nodelabel = [1:number_vertices(g);]. - tim
it turned out that, nodelabel = collect(1:num_vertices(g)) worked. - h94

1 Answers

2
votes

Changing

nodelabel = [1:num_vertices(g)]

To nodelabel = collect(1:num_vertices(g)) solves the issue.