Operation of wb2dot is easy. It is command driven but has a telling online help. If that isn't enough this documentation provides all details you have to know about. Wb2dot does a great job at making your work easier: You only have to write down once the resulting graph of your "Why...Because"-Analysis in any ASCII editor of your choice. Then run wb2dot and you get a nicely drawn graph you can display and print. No more worries about leaving out parts of the graph or inserting errors as you are drawing the large graph with a program manually, making double work.
Wb2dot can even help you detecting errors in your WB-Graphs: It rejects syntax errors displaying appropriate error messages and searches for undefined links. When the PostScript graph is printed, it's easy to find logical errors, because you can grasp the whole graph at once. It's even possible to detect cycles: WB-Graphs are DAGs with all edges pointing from causes to their results. Because there is a time ordering imposed on the graph, no edge should point backward in time. Wb2dot produces edges oriented from right to left. So if you see any edge pointing in the opposite direction you will know something went wrong with your analysis.
Wb2dot will mark all source nodes that led to the accident automatically. Default is filling the source nodes with lightblue color. As with almost everything in this tool, you can change it according to your liking (although you have to edit the Perl source code this time - there is no parameter, sorry).
chmod 555 wb2dotafterwards (this allows you to run wb2dot like any other command). Of course, you need to have installed Perl and dot. On my system a bug occurs whenever a graph is distributed over more than one page: A string will be displayed on every page that looks like
(\\() show i str cvs show (,) show j str cvs show (\\)) showI don't know whether dot or ghostscript is responsible for it. A remedy against this is a small Perl hack named fixps. It will search for any occurence of this string and comment it out by placing "%%" in front of it. Just run it after the PostScript version of the WB-Graph has been generated:
fixps ps_file > fixed_ps_file
wb2dot
In its simplest form wb2dot expects one parameter: the name of the textual WB-Graph
wb2dot wb_fileThis will parse wb_file and report any errors to you. If there are none, a statistics will be displayed and all relevant data for dot will be written to a file using an automatically generated name. Then it will run dot which reads the newly created file and finally the PostScript file containing your graph will be written (both filenames will be displayed).
If you are interested in the EBNF syntax representation of textual WB-Graphs, look at figure 2.7 on page 18 of Karsten Loer's Diplom Thesis. Wb2dot implements it in large parts (at least that is what the author of wb2dot hopes) except for:
textgraph = firstnode { node }.where
firstnode = tag node_info ( tag | "/\" tag { "/\" tag } | node_ext | "/\" node_ext { "/\" node_ext" } ).
node_ext = "<-." number ">" | "[-." number "]" | "{-." number "}" | "(-." number ")".This is a feature.
dot -Tps dot_file -o ps_file