I think you can do this sort of thing with JGraph which is freely available.