/// <summary> /// Generates a new graph, applies the layout and recalculates the shortest paths. /// </summary> private async Task GenerateGraph() { graphControl.Graph.Clear(); randomGraphGenerator.Generate(graphControl.Graph); // center the graph to prevent the initial layout fading in from the top left corner graphControl.FitGraphBounds(); await ApplyLayout(); }
protected override Task RunModule() { RandomGraphGenerator rg = new RandomGraphGenerator { NodeCount = (int)Handler[NumberOfNodes].Value, EdgeCount = (int)Handler[NumberOfEdges].Value, AllowCycles = (bool)Handler[AllowCycles].Value, AllowMultipleEdges = (bool)Handler[AllowMultipleEdges].Value, AllowSelfLoops = (bool)Handler[AllowSelfloops].Value }; rg.Generate(CurrentIGraph); int i = 0; foreach (INode node in CurrentIGraph.Nodes) { CurrentIGraph.AddLabel(node, "" + ++i); } RandomizeGraph(); GraphControl.Invalidate(); return(Task.FromResult <object>(null)); }