Lang:C#
Edit12345678910111213141516171819202122232425262728293031using System;using System.Collections.Generic;class Program{public class Graph{private int[] _node;private int[] _next;private int[] _value;private int _count;public int N { get; set; }public int M { get; set; }public Graph(int n, int m){N = n;M = m;_node = new int[n + 1];_next = new int[m * 2 + 1];_value = new int[m * 2 + 1];}public void addEdge(int u, int v){_value[++_count] = v;_next[_count] = _node[u];_node[u] = _count;_value[++_count] = u;