I am doing composition of two automaton (Actually it is a transducer). So at the of it, I want to visually represent it to analyze it.
Which is the best tool/library for the same?
People have suggested me dot and graphviz. Which is better? I am writing code in OCaml. Does that have any library to draw that?
This is an example transducer which I want to draw?
People have suggested me dot and graphviz. Which is better?
There is no better - graphviz uses graphs in the dot language as input (and output among others), and has a layout command called dot which lays out directed graphs.
I am writing code in OCaml. Does that have any library to draw that?
I don't know OCaml, but it looks like there is ocamlgraph which is able to create the dot graphs - see also this similar question.
It also looks like there are graphviz ocaml extensions available for some platforms.
This is an example transducer which I want to draw?
Not sure what the question is, but this graph looks like it has been made with graphviz.
If you want high-quality renderings I suggest to generate dot files and then try dot2tex (never used it though) to generate PGF/TikZ to use with LaTeX. Here a few examples of TikZ automata renderings.
Related
I implemented and AVL tree using C++, at the moment I print the AVL tree to the console but I need to represent the tree using GUI as part of an application the user can use to interact with the tree. what libraries etc. should I look into in order to achieve this?
Note: I'm using OS X
The point here seems to be that some kind of user interaction is expected.
What kind of operations shall the user be able to invoke? Moving nodes, inserting, deleting?
You can go for the graphviz approach, but if you want to have user interaction, then for graphviz you should go for html output. That way you can e.g. associate nodes with clickable links where you can put some operation logic behind.
If that is not sufficient, then you will need to go for a generic GUI framework, and see what kind of libraries are available.
In case of C++, Qt is one thing to look into. There is something called a treeview that might fit to your problem (see e.g. here: http://doc.qt.digia.com/qt/qtreeview.html).
However, be prepared that it will take you some time to get into Qt.
graphviz is a graph visualization toolkit. Writing graphviz files is really simple and using one of the back-ends to spew out an image, too. You can then display those images with whatever toolkit you like.
graphviz could do the work.
And here is the document.
I am using OpenCV with c++ and I have several images with located minutiae (end/branch).
Minutiae have:coordinate(x,y) , type(end/branch) and angle.
How can distinguish one image from another having this information??
I need very simple algorithm or code or any idea!!!
Example with located points:
http://ifotos.pl/zobacz/minucjepn_xhaqnwh.png/
How can I distinguish images with thats located points??
Have a look at geometric hashing.
#user1666649, this is not as simple as you told. If you look for scientific articles, there are many of Bologne University about this. If you need a semple code you can look for NBIS from NIST/FBI. However if you are looking a good algorithm, you will need to buy a commercial one from Veridis, Neurotechnology, Aware, etc...
i'm developing some kind of heuristics for a variation of the vehicle-routing-problem in C++.
After generating a solution, i want to plot this solution. The solution is a composite of various tours, all starting and ending at a common depot.
Therefore i have a vertex-set with all the coordinates and edges defined by two vertex-id's each. Furthermore i have all the distances between vertex-pairs of course.
It would be helpful to plot this in an extra-window opening in my program, but writing a plot to a graphics-file should be okay too.
What is an easy way to plot this? How would you tackle this?
First i tried to look for common graph-visualization packages (graphviz, tulip, networkx (python)), but i realized that all of them are specialized at graph-layouting (when there are no coordinates). Correct me when i'm wrong.
I don't know if it is possible to tell these packages that i already have the coordinates, helping the layouting-algorithms.
Next thing i tried is the CGAL library with geomview output -> no luck until now -> ubuntu crashes geomview.
One more question: Is it a better idea to use some non-layouting 2d-plot-libraries risking a plot, which isn't really good to view at (is there more to do than scaling?) or to use some layout-algorithm-based-libraries (e.g. graphviz, tulip, networkx), feed them with the distances between the vertices and hope the layouting-algorithms are keeping the distances while plotting in a good-to-view-at way?
If non-layouting-plotting is the way to do it: which library do you recommend?
If layout-based-plotting is the way to do it: how can i make use of the distances/coordinates in these libraries? And which library do you recommend?
Thanks for all your input!
Sascha
EDIT: I completed a prototype implementation using the PLplot library (http://plplot.sourceforge.net/). The results are nice and should be enough for the moment. I discovered and chosed this library because a related project (VRPH Software Package / Groer) used this plot and the source code was distributed. So the implementation was done in a short amount of time. The API is in my opinion bit awkward and low-level. Maybe there are some more modern (maybe not a c-based library) libraries out there? MathGL? Dislin? Maybe i will try them too.
The nice thing about drawing multiple tours in a vehicle routing problem is that "not so bad" algorithms tend to discover nice non-overlapping and divergent tours which is really good for the eye ;-)
It is not quite clear what you are trying to archive, but if I understand your question correctly, then you could do it using OpenGL. Having vertex coordinates, it should be fairly easy.
You can use Gnuplot with a input text file that contains your solution.
It is convenient to draw the points (vertex) then lines (agents paths) than link them.
To make the plot script easy, you can have a separate file for each vehicle, if the number
of vehicles is known.
check out:
http://www.cleveralgorithms.com/nature-inspired/advanced/visualizing_algorithms.html
In a nutshell, I want to have different faces for some types of file in dired mode. I don't think it matters, but I am using Aquamacs.
The example I will use here is .tex files. If I can do it for .tex, then I can just apply the same structure to do create other faces for other types of files.
From what I understand, I have to create a variable, write a regular expression, then apply a hook. I read a bit about regex and so far I have
^(.+)\.tex$
I think my structure and regular expression are not really correct. I am not a programmer (though I have an interest on it), I have only been using Emacs for 2 weeks or so, so any help would be greatly appreciated.
What I need is at least the basic structure of what I have to do. I understand there may be modes already created that do something similar (such as maybe Wdired and Dired-X), and I would not complain if someone told me about them, but what I really want is to have an elisp code (either already written or that I can work on), as I plan on learning a bit of elisp to be able to write my own customisations and this would be a way to learn.
Thank you!
Since you want to learn how to do it, try checking out the extension dired+.el. This mode does a lot more than what you want, but it does add new faces. Specifically, look for the variable diredp-font-lock-keywords-1 and how it is used. That should get you going.
Other SO questions that seem relevant are:
Match regular expression as keyword in define-generic-mode
Highlighting correctly in an emacs major mode
A hello world example for a major mode in emacs?
I need to draw some pictures for my LaTeX documents, and I've found that hand-made PostScript seems to be a good fit (I want to do stuff programatically, need math functions, etc.). I've also tried TikZ but that just seemed overcomplicated and hard to use.
However, using plain standard PostScript is a bit painful since there aren't really any standard functions for drawing shapes (e.g. not even rectangles).
Is there any PostScript library that would include functions for common shapes and make life a bit easier? Seems to me this problem should be fairly common.
Or should I skip PostScript and move on to some superior system? Which one?
A few people and many PostScript drivers define their own set of procedures for drawing shapes. A PostScript driver may output the following shortcuts:
/bd{bind def} bind def
/cp{closepath}bd
/gs{gsave}bd
/gr{grestore}bd
/m{moveto}bd
/rm{rmoveto}bd
/l{lineto}bd
/rl(rlineto}bd
/s{stroke}bd
/f{fill}bd
/sf{gs s gr f}bd
/xx{exch}bd
/rect {4 2 roll m 1 index 0 rl 0 xx rl neg 0 rl cp} bd
Then, a rectangle would be drawn like this:
0 0 100 100 rect sf
The cumbersomeness of this does make PostScript particularly hard to deal with. MetaPost may be a better fit if you your drawings are programmatically/mathematically generated. MetaPost generates encapsulated PostScript (which you can include in your LaTeX document) but it is more suitable for drawing images with algebraic definitions.
I like using matplotlib. It can generate both postscript and PDF directly, it's in python, and it can also do pretty sophisticated plots (hence its name). If you want to hack PostScript directly you'll be able to use psticks in LaTeX, but you'll need to run-trip everything through dvi2ps and then ps2pdf to make PDFs. Do you really want PostScript or PDFs? I think that you want PDFs, right?
OK, I've decided that Asymptote is the best thing since sliced bread. Handles drawing both graphs and arbitrary figures really well, and has a vast number of extension modules (including MetaPost compatibility if you care about that). Additionally it typesets text using LaTeX which is just incredibly cool. As an added bonus it even outputs directly to PDF (or EPS).
I still think it's a bit sad there's no good libraries of routines for good ol' PostScript though.
I have used Asymptote (for graphs though) but I found it tiresome to learn yet another custom language. If you're familiar with Python, you can give PyX a try. Its feature set is similar to that of Asymptote. For example, it can also use LaTeX for typesetting text/math.
Another option is Enthought Enable, but that is probably less suited.
I've had good results constructing images directly in postscript. One helpful convention I've found is to treat objects like glyphs in a font. So each object expects the currentpoint to be set at, say, the bottom left corner, and leaves the currentpoint at the bottom right. The you can put them in an array and forall through it: each object leaves the currentpoint ready for the next one.
Generate SVG, then use something like iText and/or Inkscape to programmatically convert to PDF/PS. I built a publishing stack this way and it worked out really nice.
There are lots of postscript libraries
look here
http://www.ericlindsay.com/computer/printing.htm
and here
http://www.tinaja.com/post01.shtml
and here
http://seit.unsw.adfa.edu.au/staff/sites/gfreeman/qs.html