Tree visualization and animation

I work with several tree search strategies in Haskell. I want to visualize them, as well as animate the search that I do in it. The best I have found so far is graphviz images, which I could generate by writing DOT files (for example, in Land of Lisp), but I doubt that this is the best approach. My trees can become quite large, so I don’t want to enter the position of each node in my program, I want them to be placed correctly.

I also looked at Gephi a bit , but I'm not sure if I can enter my data into it.

Also my data type Tree is very simple data Tree a = Leaf a | Branch (Tree a) (Tree a).

In short, I'm looking for a way to get the visualization and animation of a tree in a search strategy. I do not necessarily look for a Haskell solution, but it can be great. Also, the ability to output images / animations in a standard format, such as gif, will be a big plus.

+3
source share
2 answers

I will expand my comment: I have not studied the pricing policy of Ubigraph, but can you download the free version from your site ("basic"?). Then you can install the vacuum igigraph package (it seems that there are crashes in HackageDB build under GHC 7.0, but I just managed to install it under my 7.0.2 without any problems). After that, you can simply start ubigraph_serverand start β€œfeeding” it with your data structures directly from ghci:

import System.Vacuum.Ubigraph

data Tree a = Leaf a | Branch (Tree a) (Tree a)
data Root a = Root a

tree =
    Root
    (Branch
     (Branch
      (Leaf "A")
      (Leaf "B"))
     (Leaf "C"))

view tree, - :

enter image description here

/ . , ( Haskell, , - note shared []), , . .

+3

Ubigraph, HUbigraph, :

import Graphics.Ubigraph
import Control.Monad

main = do
  h <- initHubigraph "http://127.0.0.1:20738/RPC2"
  runHubigraph op h

op = do
  clear
  vs <- mapM (const newVertex) [0..400]
  mapM_ (setVAttr (VShape Sphere)) vs
  let bind i = zipWithM (\a b -> newEdge (a,b)) vs (drop i vs ++ take i vs)
  mapM_ bind [1..15]
  return ()

, - , 15 , , 40, ubigraph ( )!

+2

All Articles