Hubigraph: a Haskell wrap for Ubigraph

Hubigraph is a Haskell wrapper for Ubigraph, which is a tool for visualizing dynamic graphs.


Document

Download

Sample Code

A sample use of hubigraph:

example/sample.hs

import Graphics.Ubigraph
r x = initHubigraph "http://localhost:20738/RPC2" >>= runHubigraph x
main = r $ mkRing 10

mkRing n = do mapM_ (newVertexWithID) all
              mapM_ (newEdge') all
              sid <- newVStyle 0
              mapM_ (flip setVStyleAttr sid) [VColor "#ff0000", VShape Sphere]
              mapM_ (changeVStyle sid) all
    where newEdge' e = newEdge (e, next e)
          next e = (e+1) `mod` n
          all = [0..n-1]

example/callback_client.hs

import Graphics.Ubigraph
r x = initHubigraph "http://localhost:20738/RPC2" >>= runHubigraph x
main = do

  r $ mapM_ newV [1..3]
       where
         newV n = newVertexWithID n >> setVAttr (VCallback url) n
         url = "http://localhost:19999/callback_serv.bin/vertex_callback"

example/callback_serv.hs

This script runs as CGI program.

import Graphics.Ubigraph
import Network.XmlRpc.Server
r x = initHubigraph "http://localhost:20738/RPC2" >>= runHubigraph x
draw :: Int -> IO Int
draw a = do r $ setVAttr (VColor "#ff0000") a >> return 0

main = cgiXmlRpcServer [("vertex_callback", fun draw)]

Requirements

Installation

$ cabal install hubigraph

Updates

January 19, 2011

Hubigraph-0.3.2 is now available. 0.3.2 has a fix for the lack of API (Thanks Matei for this contribution). Added some edge attributes (arrow_position, arrow_radius, arrow_length, arrow_reverse).

May 14, 2010

Hubigraph-0.3.1 is now on Hackage. The module name is changed from Hubigraph to Graphics.Ubigraph.

September 5, 2009

A new release of Hubigraph is now available. 0.3 has a fix for the lack of API (Thanks Justin Quillinan). The lack is including a way to remove edges, register callbacks and change styles. Also, 0.3 makes a way to change attributes simpler (with setVAttr & setEAttr functions and VAttr & EAtter data types).

Author

Kohei Ozaki

generated by hakyll