Rendering of a graph using dot program - graphviz

I am trying to display a graph with the dot program with an example taken from https://graphs.grevian.org/example#example-2 .
I should get this output:
Instead I get this one.
How is it possible to generate the second one?
Here is the code I used:
dot graph_path.dot -Tpdf > vis.pdf
graph {
a -- b;
b -- c;
c -- d;
d -- e;
e -- f;
a -- f;
a -- c;
a -- d;
a -- e;
b -- d;
b -- e;
b -- f;
c -- e;
c -- f;
d -- f;
}
Edit
In the man page of dot in my terminal (under MacOS 11.6.1), the following is written:
...
OUTPUT FORMATS
Graphviz uses an extensible plugin mechanism for its output renderers, so to see what output formats your
installation of dot supports you can use ``dot -T:'' and check the warning message. Also, The plugin mechanism
supports multiple implementations of the output formats, allowing variations in the renderers and formatters.
To see what variants are available for a particular output format, use, for example: ``dot -Tpng:'' and to
force a particular variant, use, for example: ``dot -Tpng:gd''
...
So I assume that Graphviz is used
EDIT 2
thanks to the answer of sroush, there are several commands to create graphs such as:
dot graphK6.dot -Tpdf > vis1.pdf
sfdp graphK6.dot -Tpdf > vis2.pdf
neato graphK6.dot -Tpdf > vis3.pdf
circo graphK6.dot -Tpdf > vis4.pdf

Indeed, this is a Graphviz result, but it was not produced by the dot layout engine. It was produced by the circo layout engine.
Graphviz has 6 primary engines (and more related programs) that all take the same input language.
Circo is not well documented, but here is the common "man" page. (http://www.graphviz.org/pdf/dot.1.pdf)
Here is the same input run through the 6 primary engines:

Related

unix Diff utility - how to generates output file without < or >?

I am using diff to see the differenceS between 2 files.
It generates the output like:
some numbers here
< gi|description1
< ADGCAAAGGCC
---
> gi|description3
> GGCCTAAGGGG
Can I produce the output like:
gi|description1
ADGCAAAGGCC
gi|description3
GGCCTAAGGGG
without < , > ,--- , the first numbers line ????
Thanks a lot.
Certainly you can modify the output of the diff utility to your liking. In the end it is a utility in the typical unix tradition, so one would expect it to be tweakable into all directions :-)
The "man page" explains the options and points out the ...-line-format options for this. Take a look yourself: man diff...
This leads to a command like this:
diff --unchanged-line-format="" --old-line-format="%L" --new-line-format="%L" file1 file2
It outputs only lines that have changed and for those simply the literal old and new form without any further indication marks. Which is what you want, according to your example.

visualizing yosys output not working

I'm using the (probably incorrect!) command
yosys -f verilog -p "prep; show stretch count.dot" count.v
for the following simple example
module count(input clk,output [7:0] LEDS);
reg [26:0] count;
assign LEDS = count[26:19];
always #(posedge clk) begin
count <= count + 1;
end
endmodule
Its not working as I'd expect giving no output to a file name I don't want...
3. Generating Graphviz representation of design.
Writing dot description to `/home/chris/.yosys_show.dot'.
ERROR: Nothing there to show.
Whats the correct way to do this?
The command line your are apparently looking for is:
yosys -p "prep; show -stretch -prefix count -format dot" count.v

Is it possible to infer the edit distance using a unified diff?

I have 2 files with contents spanning multiple lines. I'd like to find the edit distance; i.e. how many changes are required to transform A to B assuming only insertions and deletions are possible.
> cat > A
A
B
C
D
E
> cat > B
A
B
D
D
F
E
> diff -u A B
--- A 2015-05-12 16:09:31.000000000 +0200
+++ B 2015-05-12 16:09:42.000000000 +0200
## -1,5 +1,6 ##
A
B
-C
D
+D
+F
E
Would it be accurate to say that the total number of + and - give me the edit distance?
Going by your definition of edit distance (similiar to "Longest common subsequence problem"), you will first need to define what a single change is.
a single character?
a line?
a file?
The longest common subsequence problem is a classic computer science
problem, the basis of data comparison programs such as the diff
utility, and has applications in bioinformatics. It is also widely
used by revision control systems such as Git for reconciling multiple
changes made to a revision-controlled collection of files.
Assuming you want lines to define a change (based on your example), then yes, the total number of + and - using the diff command would suffice. This is because an update/substitution will show up as both a deletion (-) and an insertion (+).
See also http://en.wikipedia.org/wiki/Diff_utility#Unified_format

Graphviz nodes rendering

I have a simple graphviz graph that is drawn as shown in the following image:
digraph G {
"Model" -> "Task";
"Task" -> "Worker 1" -> "Sink";
"Task" -> "Worker 2" -> "Sink";
"Task" -> "Worker 3" -> "Sink";
}
Adding and edge between the sink and task nodes, the graph output is shown the following image:
"Sink" -> "Model";
How could I add this edge and keep the original symmetric node layout shown in the first image?
(Edited to improve my original answer)
Building on the answer to How to control subgraphs' layout in dot?, if we start by laying out the core digraph with dot, we can then use neato to add the additional edge. neato allows nodes that already have defined positions to be pinned using the -n parameter so one could do something like this (where symmetric.dot contains the original GraphViz digraph with the addition of graph [splines = true]):
#!/bin/bash
dot -Tdot symmetric.dot >symmetric1.dot
neato -n2 -Tpng symmetric1.dot -osymmetric1.png
sed 's/^}/"Sink" -> "Model";}/' <symmetric1.dot >symmetric2.dot
neato -n2 -Tdot symmetric2.dot >symmetric3.dot
neato -n2 -Tpng symmetric3.dot -osymmetric3.png
This script:
Uses dot to lay out the original digraph into a new .dot file.
Uses neato -n2 to plot the original digraph. The -n2 option prevents neato from moving nodes that already have positions.
Uses sed to insert the "Sink" -> "Model" edge.
Uses neato -n2 to lay out the new edge (which is the only one without pos defined, and thus the only one not pinned) and plot it as a .png file.
symmetric1.png looks like this:
... and symmetric3.dot with the additional edge looks like this:

Windows utility to find numbers and do operations?

Is there such a thing that finds numbers using regex and can perform simple arithmetic operations to it?
Imagine you have a source/config file storing positions and later changed the code which requires an offset now. How do you normally go about this without doing it manually?
Edit: I knew I should've added this bit with the orignal post. I'd prefer something small and easily acquired from anywhere. I am aware of Cygwin and the wonderful util sets of linux which is why I explicitly put Windows in the title.
Get yourself a copy of Cygwin and train yourself up on bash, awk, sed, grep and their brethren.
The Windows cmd language has come a long way since the brain-dead days of MSDOS 3.3 but it's still not a wart on the rear end of the UNIX tools. Cygwin gives you all those tools and more.
A way of doing your specific task (if I understand it correctly) is to change:
a b 70 into offset 60
c d 82 a b 10
e f 90 c d 22
e f 30
The following command shows how to use awk to acheive that:
$ echo 'a b 70
c d 82
e f 90' | awk '
BEGIN {
print "offset 60"
}
{
print $1, $2, $3-60
}'
That's formatted for readability - I would tend to do it all on one line and get my input from a file rather than echoing it, but this is just for demo purposes.
If you want something a little more lightweight (in terms of what you have to install - it's still very powerrful), GnuWin32 can give you individual packagaes. Just install gawk or whatever you need.

Resources