Guest User

Untitled

a guest
Oct 2nd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. public static void Dfs(ref Graph g, int in_v, ref string res, ref bool[,] bm)
  2. {
  3. if (g.val[in_v].edges.Count != 0)
  4. {
  5. res = res + in_v.ToString() + "(";
  6.  
  7. for (int i = 0; i < g.val[in_v].edges.Count; i++)
  8. {
  9. bm[g.val[in_v].edges[i], in_v] = true;
  10.  
  11. if (res.Length > 0 && res[res.Length - 1] != '(')
  12. res = res + ",";
  13.  
  14. Dfs(ref g, g.val[in_v].edges[i], ref res, ref bm);
  15.  
  16. }
  17. res = res + ")";
  18. }
  19. else
  20. res = res + in_v.ToString();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment