Beispiel #1
1
 public Vertex(Point p)
 {
     Self = p;
     Num = Low = 0;
     Visited = false;
     Parent = null;
 }
Beispiel #2
0
 /// <summary>
 /// initialize graph from board, heavy function
 /// </summary>
 /// <param name="start">
 /// starting point, must be a valid point
 /// </param>
 /// <param name="board">the board</param>
 public Graph(Point p, bool[,] b)
 {
     counter = 1;
     rootVertex = new Vertex(p);
     board = b;
     allVertex = new Dictionary<Point, Vertex>();
     allVertex.Add(p, rootVertex);
     zones = new List<IndexedPointHash>();
     ArticulationPoints = new List<Point>();
 }
Beispiel #3
0
 private void FindArtPoints(Vertex v)
 {
     v.Visited = true;
     v.Low = v.Num = counter++; // Rule 1
     foreach (Vertex w in GetNeighbours(v.Self))
     {
         if (!w.Visited) // Forward Edge
         {
             w.Parent = v;
             FindArtPoints(w);
             v.Low = Math.Min(v.Low, w.Low); // Rule 3
             if (w.Low >= v.Num)
                 ArticulationPoints.Add(v.Self);
         }
         else if (v.Parent != w) // Back Edge
         {
             v.Low = Math.Min(v.Low, w.Num); // Rule 2
         }
     }
 }