public void Run(string dotSource) { if (_countSymbolsCheckBox.Checked) { MessageBox.Show($"Read {dotSource.Length} symbol(s)."); } var vertexFun = VertexFactory.Name; var edgeFun = EdgeFactory <GraphXVertex> .Weighted(0); var graph = Graph.LoadDot(dotSource, vertexFun, edgeFun); _steps = new Stack <List <GraphSerializationData> >(); if (!graph.Vertices.Any()) { MessageBox.Show("Graph is empty."); return; } _graphArea.LogicCore.Graph = graph; _graphArea.GenerateGraph(); _zoomControl.ZoomToFill(); HighlightToRemove(); _hasStarted = true; _hasFinished = false; }
static public UndirectedGraph <GraphXVertex, GraphXTaggedEdge <GraphXVertex, int> > GetUnderectedGraphFromDot(string dotSource) { var vertexFun = VertexFactory.Name; var edgeFun = EdgeFactory <GraphXVertex> .Weighted(0); var graph = Graph.LoadDot(dotSource, vertexFun, edgeFun); var ugraph = new UndirectedGraph <GraphXVertex, GraphXTaggedEdge <GraphXVertex, int> >(); foreach (var i in graph.Vertices) { if (!ugraph.ContainsVertex(i)) { ugraph.AddVertex(i); } } foreach (var i in graph.Edges) { var z = ugraph.Edges.FirstOrDefault(x => (x.Source == i.Target) && (x.Target == i.Source)); if (ugraph.Edges.FirstOrDefault(x => (x.Source == i.Target) && (x.Target == i.Source)) == null) { ugraph.AddEdge(i); } } return(ugraph); }
static public void Run(string dotSource, List <EdgeForVisualisation> e) { edges = e; i = -1; var vertexFun = VertexFactory.Name; var edgeFun = EdgeFactory <GraphXVertex> .Weighted(0); var graph = Graph.LoadDot(dotSource, vertexFun, edgeFun); if (!graph.Vertices.Any()) { MessageBox.Show("Graph is empty."); return; } _graphArea.LogicCore.Graph = graph; _graphArea.GenerateGraph(); _zoomControl.ZoomToFill(); foreach (var i in _graphArea.EdgesList) { i.Value.Foreground = new SolidColorBrush(Colors.WhiteSmoke); i.Value.ShowLabel = true; i.Value.ShowArrows = false; } hasStarted = true; hasFinished = false; }
public void Run(string dotSource) { var vertexFun = VertexFactory.Name; var edgeFun = EdgeFactory <GraphXVertex> .Weighted(0); var graph = Graph.LoadDot(dotSource, vertexFun, edgeFun); if (!graph.Vertices.Any()) { MessageBox.Show("Graph is empty."); return; } _graphArea.LogicCore.Graph = graph; _graphArea.GenerateGraph(); _zoomControl.ZoomToFill(); _graphVertices = _graphArea.VertexList.ToList(); _isHamiltonian = true; _currentVertexIndex = 0; _threshold = graph.VertexCount / 2.0; }