Пример #1
0
        // For example, an edge like (1, 2, 4) => there's an edge between vertices 0 and 1 with weight 4.
        public static WeightedSimpleGraph <int> CreateFromOneBasedEdges(int vertexCount, int[,] edges)
        {
            var graph = new WeightedSimpleGraph <int>(vertexCount);

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

            return(graph);
        }
Пример #2
0
 internal Vertex(WeightedSimpleGraph <T> graph, int ID)
 {
     _graph  = graph;
     this.ID = ID;
 }