Need Help with rendering graph from GraphML file

Feb 26, 2012 at 11:15 PM
Edited Feb 26, 2012 at 11:15 PM

Hello ,

I looked all the posts if I could find any help regarding rendering graph in a wpf application but failed.

I have a graphML file and I dont know how to use nodexl control to render it .

I looked in the help file as well but only I could find how to create graph manually like by creating edges and vertex etc.

            IGraphAdapter adapter = new GraphMLGraphAdapter();           

IGraph oGraph = adapter.LoadGraphFromFile(mygraph,graphml)


but rest I dont know what to do. 

It would be a great help if someone can provide me with the steps .


Feb 27, 2012 at 4:47 PM

There is sample code for using the NodeXLControl in a WPF application under the "NodeXLControl Class" topic in the NodeXLApi.chm help file.  As you've noted, however, that sample shows how to populate the graph manually by adding objects to the control's Vertices and Edges collections.

Your GraphML case is simpler, and you've already figured out how to create a Graph object from a GraphML file.  The remaining step is to get that Graph into the NodeXLControl.  Assuming that your form has a NodeXLControl named nodeXLControl1, the code would look like this:

IGraphAdapter adapter = new GraphMLGraphAdapter();          
IGraph oGraph = adapter.LoadGraphFromFile(mygraph,graphml);
nodeXLControl1.Graph = oGraph;

-- Tony


Feb 27, 2012 at 6:23 PM
Edited Feb 27, 2012 at 7:25 PM

Thank You Tony for the prompt reply it . It worked .

Feb 27, 2012 at 7:36 PM

You had a previous post, now deleted, indicating that it didn't work.  My guess is that you realized afterward that you weren't actually handling the Window's Loaded event.  You fixed it before I could reply.

I'm glad you have it working.

-- Tony

Feb 28, 2012 at 4:46 PM

:) you are right Tony. Thank you for your time and prompt replies.