Visualize bipartite graph - c#

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.

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.
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.
Disclaimer: I'm an advisor for the NodeXL project.

Actually if you could use client side jquery .. iwoul strongly recommend jqPlumbs..
http://www.jsplumb.org/jquery/demo.html

Ok, As you want,
Here is an example/library that let you create graphs and flowcharts easily,
http://www.codeproject.com/Articles/182683/NetworkView-A-WPF-custom-control-for-visualizing-a
It has actually very good features.

yFiles WPF is an extensive .NET class library for Windows Presentation Foundation (WPF) applications.
Its first-class UI controls for viewing and editing diagrams allow you to automatically arrange complex graphs, diagrams, and networks with the click of a button.
Our diagramming library crafted for Windows Forms-based applications is yFiles.NET
Graph# is a graph layout framework.
It contains some layout algorithms and a GraphLayout control for WPF applications.
Using WPF to Visualize a Graph with Circular Dependencies

If you can do it in Windows Forms, you can use NShape. Since the source is available, you could probably port it to WPF if you needed to. It might beat writing it from scratch. Or perhaps you could host a WinForms control to get the functionality you need. Not as nice as a pure WPF solution, though.

D3.js is a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation
D3 allows you to bind arbitrary data to a Document Object Model (DOM), and then apply data-driven transformations to the document. For example, you can use D3 to generate an HTML table from an array of numbers. Or, use the same data to create an interactive SVG bar chart with smooth transitions and interaction.
D3 is not a monolithic framework that seeks to provide every conceivable feature. Instead, D3 solves the crux of the problem: efficient manipulation of documents based on data. This avoids proprietary representation and affords extraordinary flexibility, exposing the full capabilities of web standards such as CSS3, HTML5 and SVG. With minimal overhead, D3 is extremely fast, supporting large datasets and dynamic behaviors for interaction and animation. D3’s functional style allows code reuse through a diverse collection of components and plugins.
http://d3js.org/
http://mbostock.github.com/d3/talk/20111116/force-collapsible.html

Related

Generating an Organogram in MVC and Displaying in View

I imagine this question will not bear anything, but this is a last ditch attempt before I have to tell my PM I simply can't do it.
My colleague (usefully before leaving the project) was a yes man to everything our PM asked for, regardless of what it was, and I seem to have been volunteered to create some functionality that will generate an Organogram / Organisational Chart and present it in the view.
I have dug around and asked around, no one really seems to know how I would go about doing this. Can anyone offer any advice on anything that can help? Even if it's the most basic tutorial or obscure API ever, it will be helpful.
To put a point on it, my question is: Is it possible to generate a chart in an ASP.NET MVC C# Application, and display it on a View? (Even a yes or no would help)
Yes, everything is possible. It's just a matter of how much time you can spend on it. Not everything has a good return on investment though, but that's for your PM to decide. As long as your team can make an estimation of the complexity.
But for ASP.NET, Microsoft has a Charting library that allows you to build charts. There are also commercial libraries (the first google hit) out there that are more feature rich.
And if they don't work, you can Always build images manually using the System.Drawing namespace of .NET (that will of course take considerably more time than plotting a chart using one of the available libraries). Generated images can be sent through an ashx handler, or you can embed the image in the same page using base64 encoding.
It's not bad to say yes to your PM, but I rather say: "Yes, we will stick this feature on the feature list / back log, and make a estimate of the complexity. Once we know the complexity you can choose to select it for a future iteration." But perhaps I'm talking too Agile now ;-)
You can hand off the chart drawing to an external library, for example, Google Visualization: Organizational Chart
Have a look at this question for other suggested librairies:
What's the best library to draw organization chart using JavaScript?
This sounds like it's in a commercial scenario, so it's really worth looking at the commercially available solutions. Steven already mentioned one, but as far as I can see that one is for Windows Forms and the other one is for charts as in bar charts and provides no organigram features.
A Javascript diagramming library with the capabilities of displaying organizational charts is yFiles for HTML. It has a nice online example of an organization chart that might be exactly what you are looking for:
There is also a Video that shows the demo in action.
The library is a pure Javascript implementation that does not depend on server libraries or servers at all. Integrating it in an ASP.net environment should be easy though, as long as you know Javascript. Being a library it offers full customization capabilities. You can determine the look and the feel of all aspects of the chart. Under the hood the library is a generic graph drawing and editing tool and the organizational chart is just one possible use-case.
Full disclosure: I work for the company that created the library, but on SO I do not represent my employer. My comments, thoughts, etc. are my own.

Best C# UI component for displaying entities and its relationships

I am creating a UI rich application in C# forms (.net 4.5) for managing/displaying family tree. I tried using many already available products. But none of the free products available have the feature to display and print the complete family tree in a screen. So I have decided to write one myself.
Now I have decided to use graph for the UI and a node will be created depicting each person in the database. I am planning to parse through the complete database in the step 1 and create a logical graph. Step 2 is to display the logical graph with a rich UI. I am planning to have simple features like, when we right click on the appropriate node, we must get the option to update their information.
So my question now is, to cater the above requirement; what is the best component could be used.
Thanks in advance,
S.Sudharsan
Graph# is an open-source C# component for displaying graphs. It requires a little bit of work because it hasn't been maintained in a long time but still very useful.
I had the same problem some time ago.
The final solution was to design each graph node as a user control (so you can customize all the visual properties) and use GraphViz (in my case DOT algorithm) to calculate node positioning.
If you don't want to use any third party framework, you should do some research about graph layout (especially the Sugiyama algorithm).

Program architecture for Windows 8 C# & XAML app featuring graphics

If I'm looking to create a game that doesn't necessarily run full screen, but simply needs to feature 2D/3D graphics somewhere in a portion of the screen, what's my best approach?
Some specific questions could be:
What component would the rendered area use?
Are there any game libraries I could leverage for the rendered area?
What would be the most "pure" or "canonical" stack according to Microsoft to use here?
Omega --
Visual Studio 2010 and 2012 are Both WPF apps. WinRT is for Tablets / Mobile. WPF is certainly NOT outdated.
If I were you I wouldn't render everything out the way canvas forces you to, it might be a better approach to have the center item be a UI element named Frame, which is the base element for all UI related content in WPF.
In this way you would be able to leverage all of the possible types of controls in the Frame whether you decided that An ImageSourceType or Canvas is more applicable to a particular features of the game.
Depending on how you want to draw graphics, you could use (but are by no means limited to):
Canvas - which would be totally appropriate for slow moving games. This way you get the benefit of the various WPF layout routines and can define objects inside the scene in XAML/vectors as well.
WPF supports 3D graphics (using Direct3D on the backend) so you could probably set up an orthogonal projection matrix and treat it like a Direct3D context (with the WPF API). I don't have enough experience to know how slow this is compared to D3D, but it's certainly easier (built-in "scene graph" like support from the XAML architecture, for instance).
If you want to go whole-hog with Direct3D you could use SlimDX, which has a WPF shim that I've used in the past, as well as another third party control. There may be other libraries available as well.
Direct blitting to/from a Bitmap using WriteableBitmap (see WriteableBitmapEx for a third-party version with a much friendlier API) or similar.
There are probably a lot of other options too. My preference would be for using Canvas initially if it's a slow-paced game that doesn't need super-fast frame rates (the layout work does incur a fairly substantial overhead, but it's less work and may be easier to get looking exactly the way you want).
If you want absolute control and speed, use D3D through SlimDX, but this is a pretty hefty learning curve if you're new to it.

How to plot XY graph in C#?

I am developing an application in C# which deals with specific genetic algorithm problem. The execution of the algorithm provides output parameters that are required to draw a chart.The graphic chart consists of 2 independent axis, lets say X is number of generation and Y represents corresponding maximum value of fitness function. To be more specific, I've uploaded picture from Excel so here it is :
http://img97.imageshack.us/img97/2046/graphnb.png
My priority is to make this application fully-functional by allowing user (who sets random execution factors such as mutation percentage, population and generation number, number of elite individuals, etc.) to see generated X-Y graph inside the generated "Form" in C#. I've found site that partially solves my problem, but that's not the whole point (http://csharp.net-informations.com/excel/csharp-excel-chart-picturebox.htm). So I'm asking if there is a way to implement mentioned graph by not using any other applications, but maybe only C# libraries and functions for plotting or something like that? Hope I made myself clear. Best regards.
Free and native answer is http://zedgraph.org/wiki/index.php?title=Main_Page
Does not involve WPF
Does not cost
Only C# libraries
Works inside a .NET WinForm
personally I like XtraChart of DeveloperExpress, but there are also many many other cheaper or more expensive alternatives, also other questions similar to yours here in SO: WPF chart controls
I like to use libraries whenever I can so I can focus on my real business case instead of trying to re-invent the wheel everytime, also because usually it's not trivial to reach the same level of results of people working hard to deliver specific components.
As all have said you have to work on WPF (different platform then WinForms) with 3rd party charting library that are much easier to integrate with your application.
If you want to know further about charting library then you should see this page
Click here
If you can use it, try WPF. It's much better for developing graphically rich user interfaces than standard Windows Forms -- especially if you don't want to use third-party libraries.

Comparison between MS Charts and ZedGraph?

Question: Anybody has experience with ZedGraph / MS-Chart controls ?
I am thinking about which to use ?
Basically, I have a tendency to ZedGraph,
because I need .NET framework 2.0 while MS-Chart is 3.5 (and I don't know how well a 3.5 assembly works on 2.0)
and because I could use it privately, too (I use Linux privately).
But I don't know if MS-Charts offers more.
Does ZedGraph for example offer reasonable quality 3d piecharts ?
And reasonable color design, like gradient colors ?
And if it does, is it as simple (or nearly as simple) as MS-Chart controls ?
And does ZedGraph offer databinding, e.g. a datatable from a database ?
I've tried some examples in my free time.
With a bit of minor tweaking, ZedGraph's quality is just as good as MS/Dundas Chart controls.
Here's an example of a 3d piechart:
http://www.codeproject.com/KB/web-image/3dpiechart.aspx
Zedgraph is a bit more user-unfriendy than MS/Dundas chart controls.
However, Zedgraph is also more powerful and faster, while the rendering quality is the same.
Plus Zedgraph is cross-platform, while MS-Chart controls is limited to windows (by license, not by technique).
So the way to go is definitely Zedgraph.
A deeper reason can be found here:
http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/1271d98f-f52e-424d-a0dc-8bc831a5f4b8
I have used MSCharts since they went RTM and have been pleased with them for many different kinds of charts; however, I find them deficient when I want to generate a plot or a graph. For these, ZedGraph seems to offer a more appealing solution.
The MSChart Samples environment can give you a good idea of the capabilities of that library. You can compare the samples environment to the demos from the ZedGraph wiki to see they have a lot of overlapping capability. I've just found that this kind of chart is pretty difficult to create with MSChart.
I have used them to create complex dashboards, and they are very stable, well written pieces of code. However, you have to consider the fact that whichever you would be betting on, would actually be there for a long time.
Additionally, if you're using MSCharts, you would be able to use the same knowledge to build charts for web applications as well (on ASP.net)
However, if you are using them in a server ASP.net based environment, the only issue with MSCharts is that they are not dynamic charts i.e. they are rendered as images and returned from the server. They use image maps to support HyperLinks / Tooltips, and work pretty well.
I haven't used MSChart, but from my experience with ZedGraph, you can't make 3-d charts. ZedGraph also requires a bit of tweaking to make really sharp looking graphs (if you notice, most of their examples don't qualify for this title).

Categories