LightGraphs -- creation of digraph?

#1

Three simple/elementary questions for first attempts of using LightGraphs:

  1. With M a matrix, command g = DiGraph(M) produces the graph I’m interested in, but how does LightGraphs know whether M is meant to be an adjancency matrix or an incidence matrix?
  2. If an adjacency matrix is assumed, what happes if the non-zero elements of M are floating point numbers and different from 1.0? Are they converted to 1 or 1.0? Or are the numbers preserved and used as, say, some weights?
  3. Suppose I want to plot the graph using gplot() of GraphPlot, and that I have specified different colors for the various nodes using gplot(g,nodefillc = V) where V is a vector of colors. Is there a separate keyword for specifying the alpha color, valid for all nodes?

Thanks!

#2

Re 1. I think it is always assumed that the matrix is for adjacency.
Re 2. I guess that the matrix is not actually stored, but only used to fill the adjacency lists of SimpleDiGraph.

#3

Thanks.
One thing that is confusing… the documentation talks about SimpleGraph and SimpleDiGraph, but I’ve seen some examples where they instead use the constructors Graph and DiGraph. Are the latter synonyms, or names from previous versions of LightGraphs?
In other words: is it more future proof to use SimpleDiGraph than using DiGraph?

#4

They are just aliases, so you can use either without problem: https://github.com/JuliaGraphs/LightGraphs.jl/blob/1c92ad8f8f88a58e04b4a933c0f705b105bbd942/src/LightGraphs.jl#L183-L201

#5

Super; thanks!
A final question… I have tried to use GraphPlot, which is simple to use and in general ok. However, it does not handle self edges well…
As an example of a much better treatment of self edges, see picture below – taken from Boyd and Vandenberghe’s 2018 Introduction to Applied Linear Algebra.

  • Does any of the plot packages for Graph come close to the quality in the above figure?
  • Does any of the packages support LaTeX typesetting of math?