Choosing graph manipulation library for your Flex app
The open-source movement plays a pretty big role in everyday life here at Grid Dynamics. We always try to do our best to improve the software we're working with and contribute back into the community.
While developing an RIA project we faced a need to display complex graphs within an Adobe Flex application. It turns out that there are not many solutions to this problem existing at the moment. Actually AFAIK there are only Flare toolkit, yFiles Flex, SpringGraph and Flex Visual Graph Library (further on FVG). Having done the comparison between the libraries we have chosen Flex Visual Graph Library as our current graphing solution.
However, it is a young project so it is expected to be imperfect. Here are the main drawbacks that sometimes annoy me:
As we going to use the library further we will definitely continue to put effort in. So our next step is going be reviewing the FVG's architecture and proposing plans for refactoring the code. On the features side, we're going to have a hierarchical layouter that will be able to support multiple root nodes, a zooming engine that will preserve label and node size, node renderer that supports overlay icons, improved edge-node connections... lots of fun things to come.
While developing an RIA project we faced a need to display complex graphs within an Adobe Flex application. It turns out that there are not many solutions to this problem existing at the moment. Actually AFAIK there are only Flare toolkit, yFiles Flex, SpringGraph and Flex Visual Graph Library (further on FVG). Having done the comparison between the libraries we have chosen Flex Visual Graph Library as our current graphing solution.
Good Things and Bad Things
Here is the list of the most distinctive features of the FVG:
- It is an open-source project so everyone can use it for free and modify it in the way he likes;
- It can render not only trees but also (relatively) complex graphs;
- It contains a number of algorithms for performing layout;
- Laying out the graph is performed on the client-side and no server resources are involved in the process.
However, it is a young project so it is expected to be imperfect. Here are the main drawbacks that sometimes annoy me:
- A somewhat monolithic library design, god-classes anti-pattern here and there; favor is given to state changes instead of the parameter passing. I would also mention here coding conventions, although it is surely my personal impression;
- Lack of documentation on layout algorithms; incomplete design diagrams, tutorials and examples.
When dealing with someone's else products instead of the homegrown ones you will almost always find its feature set is incomplete. This is the case not only for open-source projects but also for closed-source ones (including commercial) and the greatest advantage of open source is that it allows you to implement the desired features and not wait until someone else does it. And surely there were missing features in FVG that our customers and we ourselves wanted to have.
Our humble help
So here is a list of the things we improved:- Fixed and successfully harnessed functionality for adding and removing of nodes. Before the fix it was impossible to do that after the graph was initialized. It seems that the developers of the library just did not need it so they haven't got it into shape.
- Fixed support for directed graphs. It was one of the most controversial changes to the library. Before, the layouting algorithms were tested only on nondirected graphs so the spanning tree in the case of a directed graph was computed in a wrong way. This led to the graph being laid out inappropriately. Now the user can choose if he wants to get the new behavior or emulate the old one.
- Enhanced hierarchical layouter. It now supports interleaving of nodes. Sibling nodes (the nodes on the same level) are placed now in a checkerboard formation so every even node is put a bit higher than an odd one. This enhances the readability of the graph and the overall appearance if nodes have text labels under them.
- Added possibility to sort sibling nodes in a specified order. This again enhances readability. Suppose that you have some text on your nodes. You can sort the siblings in the lexicographical order so you can more easily find the node you want with your eyes. Or you may want to display a certain type of nodes first. Plugging in your own sorting logic is tremendously easy.
- Added a very cool feature: graph zooming. There was nothing like that in the library before. One could only try to tune some parameters of layouters in order to achieve zooming effect but the real zooming for every layouter was impossible.
Conclusion
In general, supporting the open-source library has the following noticeable peculiarity: as with other source management models, it is always needed to keep compatibility with those who already use your library in their applications. But when a need to make significant and incompatible changes to the library appears, one can always commit the changes into a separate branch. It turns out to be a rather common practice in the open-sourced world. Although this is not as convenient as just committing the changes directly to the trunk, the approach has advantages. It allows you to not break the compatibility and let other developers test and review the new functionality. We've been maintaining a separate branch for quite a long time, partly because of tensions with the maintainers, partly because of a lack of time to perform all the necessary merges and testing. However, not long ago we decided that this will likely cause the branches to diverge in some point of time — definitely that will not add value to the library, but rather subtract from it. So we've consolidated our efforts with the maintainer of the library and presented a demo of the new features. The guys were very collaborative and accepted our changes into the trunk with just a couple of minor changes.As we going to use the library further we will definitely continue to put effort in. So our next step is going be reviewing the FVG's architecture and proposing plans for refactoring the code. On the features side, we're going to have a hierarchical layouter that will be able to support multiple root nodes, a zooming engine that will preserve label and node size, node renderer that supports overlay icons, improved edge-node connections... lots of fun things to come.
Stay tuned!
Labels: flex, graph, open source, RIA, visualization, ~Ivan Bulanov

4 Comments:
I'm struggling with the hierarchical layouter. It seems that auto-fit doesn't really work if you have an unbalanced tree. Half of my graph might be off the screen. Any ideas?
-Andrew
@Andrew: this is something that we're experiencing as well. Our biggest problem with the hierarchical layouter is, however, its inability to deal with multiple root nodes. We have plans to implement alternative hierarchical layouter and we'll try to include your problem into scope as well.
@Stan: Thanks for your efforts. I'll be watching the birdeye project closely in anticipation of an enhanced hierarchical layouter.
Hi,
Is the source code to your modified version of flexvizgraphlib available?
I am running into problems when trying to insert/remove nodes at runtime.
Thanks,
Ajit
Post a Comment
Subscribe to Post Comments [Atom]
Links to this post:
Create a Link
<< Home