Exemple #1
0
        /// <summary>
        /// Use multi-dimensional scaling to layout vertices.
        /// A distance matrix can be used to specify the distances between the vertices.
        /// Otherwise the distances will be calculated by shortest-path-length.
        /// </summary>
        /// <remarks>
        /// For disconnected graphs, dimension must be 2.
        /// </remarks>
        /// <param name="dist">The distance matrix to layout the vertices.</param>
        /// <param name="dim">How many dimensions should be used.</param>
        /// <returns>The coordinates matrix of the aligned vertices.</returns>
        public Matrix LayoutWithMds(Matrix dist = null, int dim = 2)
        {
            var coords = new Matrix(Vertices, dim);

            DllImporter.igraph_layout_mds(graph, coords.NativeInstance, dist != null ? dist.NativeInstance : null, dim);
            return(coords);
        }