Esempio n. 1
0
 public static void GetLoggedInUserInfo(Action <SA_FB_GetUserResult> callback)
 {
     GraphAPI.GetLoggedInUserInfo(result => {
         CurrentUser = result.User;
         callback(result);
     });
 }
Esempio n. 2
0
        private void BFS(GraphAPI gapi, int s, long color)
        {
            Queue <int> queue = new Queue <int>();

            queue.Enqueue(s);
            Marked[s] = true;
            while (queue.Count > 0)
            {
                int v = queue.Dequeue();
                foreach (var w in gapi.Adjacent(v))
                {
                    if (!Marked[w])
                    {
                        queue.Enqueue(w);
                        Marked[w] = true;
                        EdgeTo[w] = v;
                        DistTo[w] = DistTo[v] + 1;

                        if (gapi.Color[w] == color)
                        {
                            minDist = DistTo[w];
                            return;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 public BFSForCastleGrid(GraphAPI gapi, int s)
 {
     Marked = new bool[gapi.S];
     EdgeTo = new int[gapi.S];
     DistTo = new int[gapi.S];
     this.S = s;
     BFS(gapi, s);
 }
Esempio n. 4
0
 public BreadthFirstSearch(GraphAPI gapi, int s, int i, long color)
 {
     Marked = new bool[gapi.S];
     EdgeTo = new int[gapi.S];
     DistTo = new int[gapi.S];
     this.S = s;
     BFS(gapi, i, color);
 }
Esempio n. 5
0
 private void DFS(GraphAPI gapi, int v)
 {
     Marked[v] = true;
     //Id[v] = count;
     foreach (var item in gapi.Adjacent(v))
     {
         if (!Marked[item])
         {
             DFS(gapi, item);
             count++;
         }
     }
 }
Esempio n. 6
0
 /// <summary>
 /// 1. DFS marks all the vertices connected to s in time proportional
 ///    to sum of their degrees.
 /// 2. If w is marked, then w is connected to s.
 /// 3. If w is connected to s, then w is marked.
 /// 4. Visit each vertex once.
 /// </summary>
 /// <param name="gapi"></param>
 /// <param name="s"></param>
 public DepthFirstSearch(GraphAPI gapi, int s)
 {
     Marked = new bool[gapi.S];
     EdgeTo = new int[gapi.S];
     DistTo = new int[gapi.S];
     this.S = s;
     for (int i = 0; i < gapi.S; i++)
     {
         if (!Marked[i])
         {
             DFS(gapi, i);
         }
     }
 }
Esempio n. 7
0
        private void DFS(GraphAPI gapi, int v)
        {
            Marked[v] = true;
            int count = 0;

            foreach (var item in gapi.Adjacent(v))
            {
                if (!Marked[item - 1])
                {
                    count++;
                    DFS(gapi, item - 1);
                    EdgeTo[item - 1] = v;
                    DistTo[item - 1] = count;
                }
            }
        }
Esempio n. 8
0
        public CCForDFSHard(GraphAPI gapi)
        {
            Marked = new bool[gapi.S];
            Id     = new int[gapi.S];

            for (int i = 0; i < gapi.S; i++)
            {
                count = 1;
                if (!Marked[i])
                {
                    DFS(gapi, i);
                    //count++;
                }

                Id[i] = count;
            }
        }
Esempio n. 9
0
        //public DepthFirstSearch(GraphAPI gapi, int s, long color)
        //{
        //    Marked = new bool[gapi.S];
        //    EdgeTo = new int[gapi.S];
        //    this.S = s;
        //    for (int i = 0; i < gapi.S; i++)
        //    {
        //        int count = 0;
        //        long currentColor = gapi.Color[i];
        //        if (!Marked[i])
        //        {
        //            DFS(gapi, i, color, countIds, count, currentColor);
        //        }
        //    }
        //}

        //public DepthFirstSearch(DiaGraphAPI gapi, int s)
        //{
        //    Marked = new bool[gapi.V];
        //    EdgeTo = new int[gapi.V];
        //    this.S = s;
        //    DFS(gapi, s);
        //}

        private void DFS(GraphAPI gapi, int v, long color, List <int> countIds, int count, long currenColor)
        {
            Marked[v] = true;

            foreach (var item in gapi.Adjacent(v))
            {
                if (!Marked[item - 1])
                {
                    count++;
                    if (gapi.Color[item - 1] == color && currenColor == color)
                    {
                        countIds.Add(count);
                    }

                    DFS(gapi, item - 1, color, countIds, count, currenColor);
                    EdgeTo[item - 1] = v;
                }
            }
        }
Esempio n. 10
0
        private void BFS(GraphAPI gapi, int s)
        {
            Queue <int> queue = new Queue <int>();

            queue.Enqueue(s);
            Marked[s] = true;
            while (queue.Count > 0)
            {
                int v = queue.Dequeue();
                foreach (var w in gapi.Adjacent(v))
                {
                    if (!Marked[w])
                    {
                        string key   = v < w ? v + "|" + w : w + "|" + v;
                        var    align = gapi.dict[key];

                        queue.Enqueue(w);
                        Marked[w] = true;
                        EdgeTo[w] = v;
                        DistTo[w] = DistTo[v] + 1;
                    }
                }
            }
        }
Esempio n. 11
0
 public static extern bool Init(GraphAPI graphAPI, IntPtr device);