re-layout edges?

Topics: algorithm, glee, graph
Aug 13, 2008 at 4:58 AM
Guys,

I'm having trouble getting things to layout at all.
Here is what I have currently.
Note:            Viewer is a Microsoft.Glee.GraphViewerGdi.GViewer

            AdjacencyGraph<Node, IEdge<Node>> g = new AdjacencyGraph<Node, IEdge<Node>>();
           
... code to populate graph with nodes.

            GleeGraphPopulator<Node, IEdge<Node>> populator = GleeGraphUtility.Create(g);
            populator.Compute();

            Graph graph = populator.GleeGraph;
            Viewer.Graph = graph;

            Viewer.CalculateLayout(graph); // to generate the Glee objects.

            RandomLayoutAlgorithm<Node, IEdge<Node>, AdjacencyGraph<Node, IEdge<Node>>> layout = new RandomLayoutAlgorithm<Node, IEdge<Node>, AdjacencyGraph<Node, IEdge<Node>>>(g, positions);
            layout.BoundingBox = new RectangleF(-500,500,1000,1000);
            layout.Compute();

            foreach (Microsoft.Glee.Drawing.Node node in graph.NodeMap.Values)
            {
                PointF p = positions[(Node)node.UserData];
                node.Attr.GleeNode.Center = new Microsoft.Glee.Splines.Point(p.X, p.Y);
            }
            graph.NeedCalculateLayout = false;
            graph.GleeGraph.BoundingBox = new Rectangle(-5000, 5000, 5000, -5000);

this takes the positions (random) from the layout engine and sets the node locations. However the edges are in their previous positions. I can't see how I can layout the nodes and get the edges to calculate from that.

Anyone?

Coordinator
Aug 26, 2008 at 4:16 PM
Please use the MSAGL forum for this question

http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1925&SiteID=1