I am trying to draw a graph using Graphviz in Dot language, and this graph has edges which runs through nodes.
Please see the attached picture below.
So far I did not able to find a way to do this. Any help would be highly appreciated!.
Thanks in advance. ( Tips on any other way to render a graph like this would also be really helpful )
The information above is not that sufficient, however you can check the Drawing with Constrained ranks (Ref: Drawing graphs with dot by "Emden Gansner and Eleftherios Koutsofios and Stephen North").
Graph with constrained ranks
Please read the below for more information :Drawing graphs with dot
Had the same issue today, this worked for me in layout=dot.
(1) setting splines to false
(2) have the specific edge attribute constraint set to false, for edges which must go through another node.
splines=false
x -> y [constraint=false]
Be aware it only worked OK because I did not use a label for the edge.
Using the edge attributes taillabel and headlabel worked for me.
Related
I was following the guide at https://kateto.net/network-visualization, and was wondering if there is a way to set the curvature of the polygons produced by the mark.groups option to zero, and so that their borders are straight lines (ideally they would still "loop around" the different sized nodes).
If possible, I would like the polygons to wrap exactly around each node (without any space inbetween), but if that is not possible, I can work with setting the size of the nodes to zero.
Any help is appreaciated. I can also work with other software if necessary.
I couldn't find the docs before, but found them now. The additional options are mark.expand=0 and mark.shape=0: https://igraph.org/r/doc/plot.igraph.html
Goodmorning everybody,
I searched in the web for this problem for something like an hour an nobody seemed to have my same difficulty, so here I am. I'll explain you my problem: I have four states (but in future they can become much more the four) A, B, C and D between which a particle can do transitions. Suppose I know exactly how many times the particle undergoes the A->B, B->C, C->D, A->C (... and so on) transitions. I want to represent my states as dots on a circle and the transitions as arrows between states, which are wider (the arrows, not the dots!) proportionally to the number of transitions. I hope I made myself clear. Is this possible on Gnuplot 4.6? Otherwise: do you know other programs able to do that? Because I saw maps like this before, but sincerly I don't even know how to search for them!!
Thank you very much for your help.
A much more suitable tool for your problem would be Graphviz. You can use the Graphviz “DOT” language to express your transition map directly, and then use the Graphviz tools to perform various types of automated layout (including circular ones) and to produce image files showing the nodes and edges in the graph. If none of the automated layouts are what you want, you can compute them yourself and set the positions explicitly, and still use graphviz's renderer.
I am trying to plot a directed planar graph in Maple but the command only accepts undirected graphs. The documentation does not mention this restriction. Is there a way to plot them in maple?
A small working example:
restart:
with(GraphTheory):
G:=Graph({{1,2},{2,3},{3,4}});
DrawPlanar(G);
This works but defines an undirected graph. By changing the {1,2} to [1,2], the edge is made directional and the DrawPlanar fails.
Does anyone know how to create a planar plot of a directed graph?
You could use the GraphTheory:-DrawGraph command.
The various display options of the DrawGraph command will not produce something laid out exactly like how DrawPlanar would do it.
I don't know of any reason for DrawPlanar to not support directed graphs; it just seems to be how it is programmed. I would suppose that DrawPlanar could be (re)programmed to use instead a mix of HasArc and HasEdge commands, etc, and attain the broader functionality.
Using iGraph, how can I represent self-reflexive nodes with circle shaped curves? By default, these curves are represented by a pinched or tear drop shaped loop.
As Spacedman said, you would need to do quite some programming to do this. You could plot a graph without self-loops and then add them (graphs are basically a scatterplot and you can use points and similar functions to add lines to them), but this is not trivial (especially since you need to know the edge of nodes, not their center) and will cause the selfloops to be plotted on top of everything else which might not look good.
This weekend I have updated qgraph with how self-loops work. qgraph can be used to plot networks and should play nicely with igraph. e.g.:
# An adjacency matrix:
A <- matrix(1,3,3)
library("igraph")
# igraph graph and layout:
Graph <- graph.adjacency(A)
Layout <- layout.circle(Graph)
# Plot in qgraph:
library("qgraph")
qgraph(get.adjacency(Graph,sparse=FALSE),layout=Layout,diag=TRUE,directed=TRUE)
I am quite content with how these self-loops turned out and they seem to be more to what you describe. So this could be an option. However, my loops are just as hardcoded. For reference, I compute the edge of a node (starting and ending point of the loop) with the inner function qgraph:::Cent2Edge and compute the shape of the loop (spline) with the inner function qgraph:::SelfLoop.
Inside plot.igraph you can see that loops are drawn using a plot.bezier function, and all the control for that is pretty much hard coded there. You'd have to rewrite large chunks of plot.igraph to call a plot.circle function you'd have to write to do this.
Also, I'm guessing you don't want complete circles, but circle segments that start on the edge of the vertex symbol (the default blue circle with the vertex number in it) and end (possibly with an arrowhead) on another part of the edge of the vertex symbol? Or do you want circles that touch the symbol like the bezier teardrop loops do?
Either way, the answer seems to be 'no, not without doing some programming or submitting a feature request to the igraph guys'
I posted an earlier answer saying the layout functions were involved, but that's not true - the layout functions only position the vertices, and it is plot.igraph's job to draw the edges.
I'd like to be able to draw arcs between edges in graphs, as shown in the example below -- I'm using them to communicate information about the parameterizations of graphical models, and doing it by hand gets pretty old.
I've been using graphviz, which doesn't appear to supports that kind of annotation (if the answer confirming my fears at Connecting arcs between lines in Dot (GraphViz) isn't correct, that would make my day -- I really do need proper arcs and not the workaround the answer offers.) Are there any libraries (such as the JUNG library for Java) or tools that would make this possible?
Thanks,
Chris
You could consider reading in the layouted text output from dot, rendering the graph yourself and adding your annotation automatically. That would at least save you the (considerable) effort of implementing a routing algorithm.