Search code examples
c#wpfvisualizationbipartite

Visualize bipartite graph


Can someone recommend a library or code to visualize bipartite graphs in C#?

Graph# seems not to support this kind of graph directly (but has some support to disentangle vertices).

I want to create some graphic like this bipartite graph with some text in the nodes. Nodes being same width and height would be ideal.

A WPF control would be perfect, as it exists for graph#. Perhaps even a XAML definition exists? As an alternativ: a report window can also be very good.

Probably someone with more experience in Graph# can provide hints on how to do this utilizing Graph#.

Tried around a bit with NodeXL but that seems not to be the perfect solution, as the nodes seems not be that much modifiable. Perhaps someone can provide a better solution. Have played with the NetworkView provided by Soroush. At the moment this comes closest to what I want.

-update- Tried out NetworkView shared by Soroush Falahati. This seems to be a good base, but is not yet that flexible as I need it. I have problems to believe that there is no library out there that can do those things out of the box. (NetworkView has the excellent feature to set connections / edges in the control which gives it an extra boost over the NodeXL). Perhaps Graph# can do even more, but at the moment I just have tried those two.


Solution

  • You can approximate your bipartite graph visualization in NodeXL, and even improve on it by removing edge crossings. I took your sample bipartite graph, and in the image below I colored the nodes by their side (u or v). They are laid out using the Sugiyama algorithm that minimizes edge crossings. I did this in the interactive NodeXL template for Excel 2007--2013, but all these features should be available as the standalone NodeXL C# and WPF class libraries. The current libraries as of this post are available to download here.

    Bipartite graph in NodeXL Sugiyama layout

    I also tried NodeXL's group-in-a-box layout to separate the groups and display them each individually in a grid, with marginal results.

    NodeXL bipartite graph

    Disclaimer: I'm an advisor for the NodeXL project.