private void MarkEdge(TVertex src, TVertex stc, RGBcolor color, int width) { if (!Field.SetColorAndWidth(ServiceFunctions.EdgeRepresentation(src.GetRepresentation(), stc.GetRepresentation()), color, width)) { Field.SetColorAndWidth(ServiceFunctions.EdgeRepresentation(stc.GetRepresentation(), src.GetRepresentation()), color, width); } }
public bool SetColor(string key, RGBcolor color, bool raise = true) { GraphModel m; if (_models.ContainsKey(key) && !(m = _models[key]).Marked) { m.Color = color; if (raise) { FieldUpdate?.Invoke(null, null); } return(true); } return(false); }
private void DFS_Gt(Graph <TVertex> G, TVertex v, SortedDictionary <TVertex, bool> visited, List <TVertex> components, RGBcolor color) { visited[v] = true; Field.SetColor(v.GetRepresentation(), color); Thread.Sleep(600); components.Add(v); foreach (var adj in G[v]) { if (!visited[adj.Vertex]) { Thread.Sleep(500); DFS_Gt(G, adj.Vertex, visited, components, color); } } }
private void BFS(Graph <TVertex> G, TVertex v, SortedDictionary <TVertex, bool> visited, List <TVertex> components, RGBcolor color) { visited[v] = true; components.Add(v); Field.SetColor(v.GetRepresentation(), color); Thread.Sleep(600); Queue <TVertex> Q = new Queue <TVertex>(); Q.Enqueue(v); while (Q.Count != 0) { var x = Q.Dequeue(); foreach (var w in G[x]) { if (!visited[w.Vertex]) { visited[w.Vertex] = true; Field.SetColor(w.Vertex.GetRepresentation(), color); Thread.Sleep(600); components.Add(w.Vertex); Q.Enqueue(w.Vertex); } } } }
private void MarkVertices(TVertex a, TVertex b, RGBcolor color, int width) { Field.SetColorAndWidth(a.GetRepresentation(), color, width, false); Field.SetColorAndWidth(b.GetRepresentation(), color, width); }