How could I draw an arc graph in GraphViz? I can't force nodes to stand in one line.
As I don't have enough reputation to add a comment, I post some suggestion here. The following code solve the problem of force nodes to stand in one line.
digraph "test-graph" {
graph [rankdir=LR]
node[shape=circle, color=lightblue,label="",style=filled,width=0.3];
edge[arrowhead=none,splines=line];
1->2;
2->3;
edge[splines=curved];
1->3[constraint=false];
}
but don't have power for semi-circle edge. You can try other tools,such as Tikz.
Related
I would like to increase the border width of my nodes, but I find that the arrow heads in digraph edges do not respect the added width. Instead, they sink into the border. Here's my simple graph.
strict digraph {
a [penwidth="10.0"];
b [penwidth="10.0"];
a -> b;
}
How could I either increase the node width safely, or distance the edges further back? Reading through the attribute list, I didn't find a way. The closest was peripheries, but it makes multiple narrow peripheries instead of a thick one, but the edges do stick to the outermost periphery.
This is a known bug: https://forum.graphviz.org/t/allign-nodes-stroke-with-end-of-the-arrows-path-width/462
The only work-around I know is to "move" node b or shorten the edge - described in the bug report.
I have to create the nodes and edges, having interconnections. I am using d3 js for the same. Now the problem is that the graphs look so much messy. I tried using quadratic bezier curves to draw the edges between the nodes. I want that If a press a button it should rearrange into simplified view.
I happened to look at metacademy, they are a open source project. Which have the exact functionality I am looking for. https://metacademy.org/graphs/edit/new, you would need to login. However not able to find their part of code which is doing the same.
Initially created graph
After pressing the refresh button
I am pretty new to d3js, so I will be thankful for any help/suggestions.
I see this is a pretty old question, but FWIW, I designed the graph you're referring to.
Getting graphs to organize so that it minimizes edge crossing is an area of active research. For metacademy, I integrated d3.js + dagre
https://github.com/dagrejs/dagre
I drew a small planar graph with Graphviz but in one place there's an intersection of two edges. I read on SO that not all planar graphs can be drawn without intersections because it's an NP-hard problem. I also read that there aren't even implemented complex algorithms in Graphviz that do that. But that intersection is as easy to fix as possible so there probably is a way to get rid of it.
Here are the options I used:
overlap = false;
splines = curved;
nodesep = 0.5;
And here's the graph:
So, is there a way of fixing that one intersection (25-38 with 7-18) without changing the order of edges like I did here? Isn't there like at least O(n^2) algorithm that would swap two vertices and check if the intersection disappeared?
This is kind of a hotfix:
Add an invisible edge between nodes 7 and 25, ie 7 -- 25 [style="invis"];. This clause may be added to the end of the graph definition so it shouldn't interfere with any automatic generation.
It feels like cheating, however, at least the order of the payload edges in the graph definition file remains untouched.
I cannot give an explanation of why this works,unfortunately. In particular, adding edges between other nodes incident to the offending edges does not produce the desired result.
Graphviz version: 2.38.0 (20140413.2041)
What ever happend to the d3.js example on this image.
The force directed graph cluster. Second row, 3rd column?
http://vis.stanford.edu/papers/d3
I guess what you are interested in is the shapes surrounding groups of nodes.
The following examples implement it :
force-multi-foci with convex hulls
alpha-shapes aka concave hulls in d3
Hope this helps,
I would like to use graphviz for a project and am unable to get the behaviour I want. I have a graph that I can draw with graphviz just fine, but I also have a version of the same graph that has some extra edges. I would like the second graph to be drawn with the nodes in the same positions as the first one and the edges in the same positions, but the new edges to be drawn without avoiding any overlap with nodes.
To get a better idea of what I want, imagine a Powerpoint slide with a graph and then on the next slide the same graph with these extra edges that appear on top of the first graph, wihtout modifying the look of the old parts of the graph. That is the effect I want.
I think the effect could be achieved by having some edges ignore any overlapping constraints. I could not figure out how to control the overlap between edges and nodes for particular edges (or even for all edges).
Any ideas?
You can get dot to output another .dot file, with positions assigned to all elements, via dot -Tdot (or maybe dot -Txdot). Add your additional edges to that file, and run it through dot again to produce your second graph.