예제 #1
0
        // For example, edges like (1, 2), (2, 3) => there's an edge between vertices 0 and 1 and 1 and 2.
        public static SimpleGraph CreateFromOneBasedEdges(int vertexCount, int[,] edges)
        {
            var graph = new SimpleGraph(vertexCount);

            for (int i = 0; i < edges.GetLength(0); ++i)
            {
                graph.AddEdge(edges[i, 0] - 1, edges[i, 1] - 1);
            }

            return(graph);
        }
예제 #2
0
 internal Vertex(SimpleGraph graph, int ID)
 {
     _graph  = graph;
     this.ID = ID;
 }