Format LightGraph / GraphPlot

Hi!

I am experimenting with LightGraph and GraphPlot packages.

Below code is a MWE which is working. So my issue is not that my below code has a bug.
However, two things I cannot manage:

  1. How can I ensure that the node labels are not cut off from the graph. I cannot manage that the label text is fully shown for each node.

  2. How can I label the edges by passing in a matrix of same size as m_adj but filled with values?

using LightGraphs
using GraphPlot
using Random

label(n=12) = randstring(n)

n = 5
m_adj = randn(n,n) .>= 0
g = SimpleDiGraph(m_adj)
member = [1 for _ in 1:n]
member[1:3] .= 2
nodefillc = [colorant"lightseagreen", colorant"orange"][member]
labels = [label() for _ in 1:n]
gplot(g, 
      nodefillc=nodefillc, 
      nodelabel=labels,
      layout=circular_layout,
      linetype="curve")

Any hint will be helpful.

Thanks for your help!

1 Like