Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Dfs(ref Graph g, int in_v, ref string res, ref bool[,] bm)
- {
- if (g.val[in_v].edges.Count != 0)
- {
- res = res + in_v.ToString() + "(";
- for (int i = 0; i < g.val[in_v].edges.Count; i++)
- {
- bm[g.val[in_v].edges[i], in_v] = true;
- if (res.Length > 0 && res[res.Length - 1] != '(')
- res = res + ",";
- Dfs(ref g, g.val[in_v].edges[i], ref res, ref bm);
- }
- res = res + ")";
- }
- else
- res = res + in_v.ToString();
- }
Advertisement
Add Comment
Please, Sign In to add comment