locked
Changing Graph layout based on Node Selected. RRS feed

  • Question

  • Hi,

    Lets say i have a few 100 nodes with over twice the number of edges connecting nodes.  For example purpose lets consider below.

                graph.AddEdge("A", "loves", "B");
                graph.AddEdge("B", "is wife", "C");
                graph.AddEdge("C", "is love", "A");
                graph.AddEdge("B", "hates", "D");
                graph.AddEdge("D", "loves", "B");
                graph.AddEdge("A", "likes", "D");
                graph.AddEdge("C", "mom", "B");
                graph.AddEdge("B", "dad", "G");
                graph.AddEdge("A", "friends", "Jignesh");

    I observe that  gViewer is smart to detect "A" as root node and displays graph accorndingly.  What i want to achieve is if user select a node, for example "B"  then node "B" should be in center and it should display surrounding nodes of "B", and rest other nodes should be less in size/visiability.  Similarly of "C" node is selected then "C" should be in center and it should display surrounding nodes of "C", and rest other nodes should be less in size/visiability.

    Can anyone guide me on how to achieve this.

    Regards


    Thursday, August 9, 2012 4:13 AM

Answers

  • Hi Jignesh,

    It is achievable with MSAGL.  Some things to consider:

    You will not be able to use IViewer.Graph = yourGraph; way to get the layout, but you will need to create your own layout method.

    For your task you will need setting Node.BoundaryCurve for the node that change sizes.

    You will need to use IVewer.Invalidate() method for redraw.

    It is not be very simple, but it is doable.

    Thanks,


    Lev Nachmanson

    Tuesday, August 21, 2012 3:07 PM

All replies

  • Sorry, MSAGL does not have a ready to apply method for solving this. Thanks


    Lev Nachmanson

    • Marked as answer by Lev Nachmanson Saturday, August 18, 2012 10:35 PM
    • Unmarked as answer by Jignesh Desai Monday, August 20, 2012 3:59 AM
    Saturday, August 18, 2012 10:35 PM
  • Lev,

    Well i was hopping that i would get some tip or guidance or reference on my question and not just a 'sorry' reply.

    I understand that its not build in, but can anyone give some startup information/tip , so that i can do it myself, either by modifying source or some logic using existing API?

    Regards

    Monday, August 20, 2012 4:03 AM
  • Hi Jignesh,

    It is achievable with MSAGL.  Some things to consider:

    You will not be able to use IViewer.Graph = yourGraph; way to get the layout, but you will need to create your own layout method.

    For your task you will need setting Node.BoundaryCurve for the node that change sizes.

    You will need to use IVewer.Invalidate() method for redraw.

    It is not be very simple, but it is doable.

    Thanks,


    Lev Nachmanson

    Tuesday, August 21, 2012 3:07 PM