public static void GetLoggedInUserInfo(Action <SA_FB_GetUserResult> callback) { GraphAPI.GetLoggedInUserInfo(result => { CurrentUser = result.User; callback(result); }); }
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; } } } } }
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); }
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); }
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++; } } }
/// <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); } } }
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; } } }
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; } }
//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; } } }
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; } } } }
public static extern bool Init(GraphAPI graphAPI, IntPtr device);