I would like to begin by congratulating IGraphM on the release of its current update (M 0.6.1). This package makes graph calculations on Mathematica much smoother.
The specifics are available at the following web address:
As the author szhorvat says,
The IGraph/M package provides a Wolfram Language interface to the popular igraph network analysis and graph theory library, as well as many other useful functions for working with graphs in Mathematica.
igraph
is known to be a C++ library. It offers numerous functions related to the calculation of graph parameters. However, its graph layout functions are currently limited.
I've seen that ogdf, (also a c++ library), has more advantages in the drawing and layout domains of network.
I have not had a positive experience with ogdf due to my lack of familiarity with c++ (though I plan to learn c++ in the future). Python has an interface of ogdf, but installing ogdf requires more than a single click (this requires a local build of the ogdf and it beat me). Below is an example of Python utilising odgf (https://pypi.org/project/ogdf-python/).
# uncomment if you didn't set this globally:
# %env OGDF_BUILD_DIR=~/ogdf/build-debug
from ogdf_python import ogdf, cppinclude
cppinclude("ogdf/basic/graph_generators/randomized.h")
cppinclude("ogdf/layered/SugiyamaLayout.h")
G = ogdf.Graph()
ogdf.setSeed(1)
ogdf.randomPlanarTriconnectedGraph(G, 20, 40)
GA = ogdf.GraphAttributes(G, ogdf.GraphAttributes.all)
for n in G.nodes:
GA.label[n] = "N%s" % n.index()
SL = ogdf.SugiyamaLayout()
SL.call(GA)
ogdf.GraphIO.drawSVG(GA, "sugiyama-simple.svg")
GA
odgf is not only good at laying out graphs, but it also has many functions related to geometric graph theory. For example, it can calculate the crossing number of a given graph and figure out whether or not it is 1-planar. So it would be very exciting if ogdf
has an interface to Mathematica
like igraph in the future.
EdgeShapeFunction
to render the edge. However, this functionality cannot be access by users. I have requested it to be publicly exposed several times ... $\endgroup$Graph[{1 -> 2, 1 -> 3, 2 -> 3}, GraphLayout -> "LayeredDigraphEmbedding"]
. Notice that this produces curved edges that avoid collisions with vertices. It is this type of layout that is impossible to set on aGraph
expression manually. You can also contact Wolfram and request that they finally add this feature. If they suggest using a customEdgeShapeFunction
, tell them that this comes with severe drawbacks: we won't be able to customize other aspect of edge shapes! $\endgroup$EdgeShapeFunction
. $\endgroup$