How to print custom attributes in xdot - dot

I have some custom attributes in a .dot file, but running the command xdot file_name.dot does not print those attributes along with the nodes and edges.
How to do so?
I have attached the contents of .dot file for reference.
digraph toy11 {
0 [label1="", label2="<l0>", label3="(process2)"]
1 [label1="", label2="<l1>", label3="(process1)"]
2 [label1="I", label2="<l2>", label3="(process2)"]
0 -> 0 [edge_type="prior1", vedge="<a>"]
0 -> 0 [edge_type="prior2", vedge="<b>"]
0 -> 1 [edge_type="prior2", vedge="<b>"]
1 -> 2 [edge_type="prior0", vedge="<b>"]
}

Related

How to create a dictionary with a slash as key in postscript

So I know these basic dict commands in Postscript:
i dict creates a dictionary with i entries
d begin moves dictionary d to the dictionary stack
end removes the topmost dictionary from the dictionary stack
d n w put store value w under name n in dictionary d
d n get get the value of name n in dictionary d, and put it on the stack
What I would like to do is create a dictionary that represents the associativity of differend operands. The + operand and the - operand share the same priority, therefor they are both set to 0, the * and / operands also share the same priority, but have higher priority than + and - and are therefor set to 1 and so on...
The Problem is, that I am not able to set the dictionary key to / as it is treated as some kind of "delimiter". Is there any way around this, since i cannot change the keys, and I cannot create a dict like this:
/prioritydict 5 dict def
prioritydict /(-) 0 put
prioritydict /(+) 0 put
prioritydict /(*) 1 put
prioritydict /(/) 1 put
prioritydict /(^) 2 put
nor like this:
/prioritydict 5 dict def
prioritydict /- 0 put
prioritydict /+ 0 put
prioritydict /* 1 put
prioritydict // 1 put
prioritydict /^ 2 put
Any help is greatly appreciated
You could use the cvn (convert to name) operator to turn a string of any form you want into a literal name. These should all be equivalent:
prioritydict <2f> cvn 1 put
prioritydict (\/) cvn 1 put
prioritydict (\057) cvn 1 put
%!
/prioritydict 5 dict def
prioritydict begin
/+ 0 def
/- 0 def
/* 1 def
%// 1 def conflicts with immediately evaluated name
/^ 2 def
* ^ add =
If you're only going to mention it using a literal name, then you can use just a single slant.
/
That is, an empty name indicated by just the decorator followed by zero characters before the next delimiter (space or newline or parens or braces).
You should be able to define it and load it, but you can't directly make an executable name for it, so you can't make use of automatic loading like with other definitions.
/ 1 def
/ load =
/ cvx exec =

Create graph having nodes with no labels and no separations between its edges with Graphviz

I want to generate this kind of graphs with graphviz :
I tried the following code :
graph{
node [shape=none label=""]
1 [pos="0,0!"]
2 [pos="1.2145,0.694!"]
3 [pos="1.2145,2.082!"]
4 [pos="0.0,2.776!"]
5 [pos="-1.2145,2.082!"]
6 [pos="-1.2145,0.694!"]
1 -- 2
2 -- 3
3 -- 4
4 -- 5
5 -- 6
6 -- 1
}
But I get the following output
Is it possible to make nodes without labels and edges without any separation between than ?
Thanks for your answers.
digraph D {
graph [nodesep=.02]
node [shape=hexagon]
A B C
}
Gives this:
And this:
digraph D {
graph [nodesep=.02]
node [shape=hexagon orientation=30]
A B C
}
Gives this:

Insert arrows using graphdrawing library

I would like to link numbers 6 -> 5 and 5 -> 4 but I have no clue on how to do it.
My code is as follows
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{trees}
\begin{document}
\begin{tikzpicture}[>=stealth, every node/.style={rectangle, rounded corners, draw, minimum size=0.75cm}]
\graph [tree layout, grow=down, fresh nodes, level distance=0.5in, sibling distance=0.5in]
{
Flight 0 -> {
Flight 1 -> { 4 -> , 5},
Flight 2 -> { 6 },
Flight 3 -> { 7,8 }
}
};
\end{tikzpicture}
\end{document}
This is the output:
The nodes can be accessed by their name so you can simply draw arrows between them:
% !TeX TS-program = lualatex
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{trees}
\begin{document}
\begin{tikzpicture}[>=stealth, every node/.style={rectangle, rounded corners, draw, minimum size=0.75cm}]
\graph [tree layout, grow=down, fresh nodes, level distance=0.5in, sibling distance=0.5in]
{
Flight 0 -> {
Flight 1 -> { 4 , 5},
Flight 2 -> { 6 },
Flight 3 -> { 7,8 }
}
};
\draw[->] (6) -- (5);
\draw[->] (5) -- (4);
\end{tikzpicture}
\end{document}

How to understand and change CPU register FLAG in bochsdbg?

I can use 'r' to get the info of CPU register FLAG.
1.Can I understand by this?
eflags 0x00000082: id vip vif ac vm rf nt IOPL=0 of df if tf SF zf af pf cf
0x00000082= 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0
2.How to change the FLAG? By 'set' command?
<bochs:5> set eflags=0x03
:5: syntax error at 'eflags'
Thank you~
If the flag name is in capitals, then the flag is set. E.g. 'SF' means that sign flag is set, while 'sf' means it is not set. Did you mean this, or something else in your question?
The bochs manual says: "Currently only general purpose registers are supported, you may not change: eflags, eip, cs, ss, ds, es, fs, gs" (http://bochs.sourceforge.net/doc/docbook/user/internal-debugger.html#AEN3098).
Regards

How to delete duplicated rows on one file based on a common field between two files with AWK?

I have two files
File 1 contains 3 fields
File 2 contains 4 fields
The number of rows of File 1 is much smaller than that of File 2
I would like to compare between two files based on 1st field with the following operation
If the first field in any row of file 1 appears in the first field of a row in file 2, don't print that row for file 2.
Any advice would be grateful.
Input File 1
S13109 3739 31082
S45002 3800 31873
S43722 3313 26638
Input File 2
S13109 3738 31081 0
S13109 3737 31080 0
S00033 3008 29985 0
S00033 3007 29984 0
S00022 4130 31838 0
S00022 4129 31837 0
S00188 3317 27372 0
S45002 3759 31832 0
S45002 3758 31831 0
S45002 3757 31830 0
S43722 3020 26345 0
S43722 3019 26344 0
S00371 3737 33636 0
S00371 3736 33635 0
Desired Output
S00033 3008 29985 0
S00033 3007 29984 0
S00022 4130 31838 0
S00022 4129 31837 0
S00188 3317 27372 0
S00371 3737 33636 0
S00371 3736 33635 0
awk 'FNR==NR{a[$1]++;next}!a[$1]' file1 file2
How it works:
FNR==NR
When you have two (or more) input files to awk, NR will reset back to 1 on the first line of the next file whereas FNR will continuing incrementing from where it left off. By checking FNR==NR we are essentially checking to see if we are currently parsing the first file.
a[$1]++
If we are parsing the first file (see above) then create an associative array with the first field $1 as the key and post increment the value by 1. This essentially lets us create a 'seen' list.
next
This command tells awk not to process any further commands and to read in the next record and start over. We do this because file1 is only meant to set the associative array
!a[$1]
This line only executes when FNR==NR is false, i.e. we are not parsing file1 and thus must be parsing file2. We then use the first field $1 of file2 as the key to index into our 'seen' list created earlier. If the value returned is 0 it means we didn't see it in file1 and therefore we should print this line. Conversely, if the value is non-zero then we did see it in file1 and thus we should not print its value. Note that !a[$1] is equivalent to !a[$1]{print} because the default action when one is not given is to print the entire line.
If you don't need to preserve the order of the lines, you can use process substitution in Bash, Korn shell or Z shell along with the join and sort utilities:
join -v 2 <(sort file_1) <(sort file_2)
If you're using a shell without process substitution you would have to pre-sort the files.

Resources