Esempio n. 1
0
 private void Visit(GrafVertex vertex)
 {
     if (vertex.VertexType != VertexType.White)
     {
         throw new Exception("Wrong algorithm work!");
     }
     vertex.VertexType = VertexType.Gray;
     foreach (var nextVertex in vertex.NextVertexes)
     {
         if (nextVertex.VertexType == VertexType.Gray)
         {
             ThrowCycleError(nextVertex.Description.Type);
         }
         else if (nextVertex.VertexType == VertexType.Black)
         {
             continue;
         }
         else
         {
             Visit(nextVertex);
         }
     }
     vertex.VertexType = VertexType.Black;
     WhiteSet.Remove(vertex);
     Result.Push(vertex);
 }
Esempio n. 2
0
 public Graf(IEnumerable <MiddlewareDescription> descriptions)
 {
     foreach (var item in descriptions)
     {
         GrafVertex vertex = new GrafVertex {
             Description = item, VertexType = VertexType.White
         };
         WhiteSet.Add(vertex);
     }
     CreateGraf();
 }