Index: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Datatypes.cs
===================================================================
--- trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Datatypes.cs	(revision 14244)
+++ trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Datatypes.cs	(revision 14245)
@@ -49,5 +49,5 @@
   [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
   internal class igraph_matrix_t {
-    igraph_vector_t data = new igraph_vector_t();
+    internal igraph_vector_t data = new igraph_vector_t();
     internal int nrow;
     internal int ncol;
Index: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/DllImporter.cs
===================================================================
--- trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/DllImporter.cs	(revision 14244)
+++ trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/DllImporter.cs	(revision 14245)
@@ -87,5 +87,5 @@
       arpackoptions.nev = 1;
       arpackoptions.ishift = 1;
-      arpackoptions.mxiter = 3000;
+      arpackoptions.mxiter = 1000;
       arpackoptions.nb = 1;
       arpackoptions.mode = 1;
@@ -168,4 +168,7 @@
       return X86 ? igraph_vector_init_x86(vector, length) : igraph_vector_init_x64(vector, length);
     }
+    internal static int igraph_vector_init_copy(igraph_vector_t vector, double[] vec) {
+      return X86 ? igraph_vector_init_copy_x86(vector, vec, vec.Length) : igraph_vector_init_copy_x64(vector, vec, vec.Length);
+    }
     internal static void igraph_vector_destroy(igraph_vector_t vector) {
       if (X86) igraph_vector_destroy_x86(vector);
@@ -175,4 +178,11 @@
       return X86 ? igraph_vector_copy_x86(to, from) : igraph_vector_copy_x64(to, from);
     }
+    internal static double[] igraph_vector_to_array(igraph_vector_t from) {
+      var len = igraph_vector_size(from);
+      var result = new double[len];
+      if (X86) igraph_vector_copy_to_x86(from, result);
+      else igraph_vector_copy_to_x64(from, result);
+      return result;
+    }
 
     internal static int igraph_vector_size(igraph_vector_t vector) {
@@ -187,4 +197,19 @@
       if (X86) igraph_vector_set_x86(vector, index, value);
       else igraph_vector_set_x64(vector, index, value);
+    }
+    internal static void igraph_vector_fill(igraph_vector_t vector, double v) {
+      if (X86) igraph_vector_fill_x86(vector, v);
+      else igraph_vector_fill_x64(vector, v);
+    }
+    internal static void igraph_vector_scale(igraph_vector_t vector, double by) {
+      if (X86) igraph_vector_scale_x86(vector, by);
+      else igraph_vector_scale_x64(vector, by);
+    }
+
+    internal static int igraph_vector_reverse(igraph_vector_t vector) {
+      return X86 ? igraph_vector_reverse_x86(vector) : igraph_vector_reverse_x64(vector);
+    }
+    internal static int igraph_vector_shuffle(igraph_vector_t vector) {
+      return X86 ? igraph_vector_shuffle_x86(vector) : igraph_vector_shuffle_x64(vector);
     }
 
@@ -194,4 +219,8 @@
     [DllImport(X64Dll, EntryPoint = "igraph_vector_init", CallingConvention = CallingConvention.Cdecl)]
     private static extern int igraph_vector_init_x64([In, Out]igraph_vector_t vector, int length);
+    [DllImport(X86Dll, EntryPoint = "igraph_vector_init_copy", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_init_copy_x86([In, Out]igraph_vector_t vector, double[] vec, int length);
+    [DllImport(X64Dll, EntryPoint = "igraph_vector_init_copy", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_init_copy_x64([In, Out]igraph_vector_t vector, double[] vec, int length);
     [DllImport(X86Dll, EntryPoint = "igraph_vector_destroy", CallingConvention = CallingConvention.Cdecl)]
     private static extern void igraph_vector_destroy_x86([In, Out]igraph_vector_t vector);
@@ -214,4 +243,24 @@
     [DllImport(X64Dll, EntryPoint = "igraph_vector_copy", CallingConvention = CallingConvention.Cdecl)]
     private static extern int igraph_vector_copy_x64([In, Out]igraph_vector_t to, igraph_vector_t from);
+    [DllImport(X86Dll, EntryPoint = "igraph_vector_copy_to", CallingConvention = CallingConvention.Cdecl)]
+    private static extern void igraph_vector_copy_to_x86(igraph_vector_t from, [In, Out]double[] to);
+    [DllImport(X64Dll, EntryPoint = "igraph_vector_copy", CallingConvention = CallingConvention.Cdecl)]
+    private static extern void igraph_vector_copy_to_x64(igraph_vector_t from, [In, Out]double[] to);
+    [DllImport(X86Dll, EntryPoint = "igraph_vector_fill", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_fill_x86([In, Out]igraph_vector_t vector, double v);
+    [DllImport(X64Dll, EntryPoint = "igraph_vector_fill", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_fill_x64([In, Out]igraph_vector_t vector, double v);
+    [DllImport(X86Dll, EntryPoint = "igraph_vector_reverse", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_reverse_x86([In, Out]igraph_vector_t vector);
+    [DllImport(X64Dll, EntryPoint = "igraph_vector_reverse", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_reverse_x64([In, Out]igraph_vector_t vector);
+    [DllImport(X86Dll, EntryPoint = "igraph_vector_shuffle", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_shuffle_x86([In, Out]igraph_vector_t vector);
+    [DllImport(X64Dll, EntryPoint = "igraph_vector_shuffle", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_shuffle_x64([In, Out]igraph_vector_t vector);
+    [DllImport(X86Dll, EntryPoint = "igraph_vector_scale", CallingConvention = CallingConvention.Cdecl)]
+    private static extern void igraph_vector_scale_x86([In, Out]igraph_vector_t vector, double by);
+    [DllImport(X64Dll, EntryPoint = "igraph_vector_scale", CallingConvention = CallingConvention.Cdecl)]
+    private static extern void igraph_vector_scale_x64([In, Out]igraph_vector_t vector, double by);
     #endregion
     #endregion
@@ -236,4 +285,18 @@
       if (X86) igraph_matrix_set_x86(matrix, row, col, value);
       else igraph_matrix_set_x64(matrix, row, col, value);
+    }
+
+    internal static void igraph_matrix_fill(igraph_matrix_t matrix, double v) {
+      if (X86) igraph_matrix_fill_x86(matrix, v);
+      else igraph_matrix_fill_x64(matrix, v);
+    }
+
+    internal static int igraph_matrix_transpose(igraph_matrix_t matrix) {
+      return X86 ? igraph_matrix_transpose_x86(matrix) : igraph_matrix_transpose_x64(matrix);
+    }
+
+    internal static void igraph_matrix_scale(igraph_matrix_t matrix, double by) {
+      if (X86) igraph_matrix_scale_x86(matrix, by);
+      else igraph_matrix_scale_x64(matrix, by);
     }
 
@@ -259,4 +322,16 @@
     [DllImport(X64Dll, EntryPoint = "igraph_matrix_copy", CallingConvention = CallingConvention.Cdecl)]
     private static extern int igraph_matrix_copy_x64([In, Out]igraph_matrix_t to, igraph_matrix_t from);
+    [DllImport(X86Dll, EntryPoint = "igraph_matrix_fill", CallingConvention = CallingConvention.Cdecl)]
+    private static extern void igraph_matrix_fill_x86([In, Out]igraph_matrix_t matrix, double v);
+    [DllImport(X64Dll, EntryPoint = "igraph_matrix_fill", CallingConvention = CallingConvention.Cdecl)]
+    private static extern void igraph_matrix_fill_x64([In, Out]igraph_matrix_t matrix, double v);
+    [DllImport(X86Dll, EntryPoint = "igraph_matrix_transpose", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_matrix_transpose_x86([In, Out]igraph_matrix_t matrix);
+    [DllImport(X64Dll, EntryPoint = "igraph_matrix_transpose", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_matrix_transpose_x64([In, Out]igraph_matrix_t matrix);
+    [DllImport(X86Dll, EntryPoint = "igraph_matrix_scale", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_matrix_scale_x86([In, Out]igraph_matrix_t matrix, double by);
+    [DllImport(X64Dll, EntryPoint = "igraph_matrix_scale", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_matrix_scale_x64([In, Out]igraph_matrix_t matrix, double by);
     #endregion
     #endregion
@@ -271,4 +346,15 @@
     internal static int igraph_layout_davidson_harel(igraph_t graph, igraph_matrix_t res, bool use_seed, int maxiter, int fineiter, double cool_fact, double weight_node_dist, double weight_border, double weight_edge_lengths, double weight_edge_crossings, double weight_node_edge_dist) {
       return X86 ? igraph_layout_davidson_harel_x86(graph, res, use_seed, maxiter, fineiter, cool_fact, weight_node_dist, weight_border, weight_edge_lengths, weight_edge_crossings, weight_node_edge_dist) : igraph_layout_davidson_harel_x64(graph, res, use_seed, maxiter, fineiter, cool_fact, weight_node_dist, weight_border, weight_edge_lengths, weight_edge_crossings, weight_node_edge_dist);
+    }
+    internal static int igraph_layout_mds(igraph_t graph, igraph_matrix_t res, igraph_matrix_t dist = null, int dim = 2) {
+      var arpackoptions = GetDefaultArpackOptions();
+      var options = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(igraph_arpack_options_t)));
+      Marshal.StructureToPtr(arpackoptions, options, false);
+      try {
+        return X86 ? igraph_layout_mds_x86(graph, res, dist, dim, options) : igraph_layout_mds_x64(graph, res, dist, dim, options);
+      } finally {
+        Marshal.DestroyStructure(options, typeof(igraph_arpack_options_t));
+        Marshal.FreeHGlobal(options);
+      }
     }
 
@@ -286,4 +372,8 @@
     [DllImport(X64Dll, EntryPoint = "igraph_layout_davidson_harel", CallingConvention = CallingConvention.Cdecl)]
     private static extern int igraph_layout_davidson_harel_x64(igraph_t graph, [In, Out]igraph_matrix_t res, bool use_seed, int maxiter, int fineiter, double cool_fact, double weight_node_dist, double weight_border, double weight_edge_lengths, double weight_edge_crossings, double weight_node_edge_dist);
+    [DllImport(X86Dll, EntryPoint = "igraph_layout_mds", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_layout_mds_x86(igraph_t graph, [In, Out]igraph_matrix_t res, igraph_matrix_t dist, int dim, IntPtr options);
+    [DllImport(X64Dll, EntryPoint = "igraph_layout_mds", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_layout_mds_x64(igraph_t graph, [In, Out]igraph_matrix_t res, igraph_matrix_t dist, int dim, IntPtr options);
     #endregion
     #endregion
Index: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Graph.cs
===================================================================
--- trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Graph.cs	(revision 14244)
+++ trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Graph.cs	(revision 14245)
@@ -86,7 +86,7 @@
     }
     public Matrix LayoutWithFruchtermanReingold(int niter, double startTemp, Matrix initialCoords = null) {
-      if (initialCoords != null && (initialCoords.Rows != graph.n || initialCoords.Columns != 2))
+      if (initialCoords != null && (initialCoords.Rows != Vertices || initialCoords.Columns != 2))
         throw new ArgumentException("Initial coordinate matrix does not contain the required number of rows and columns.", "initialCoords");
-      var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix(graph.n, 2);
+      var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix(Vertices, 2);
       DllImporter.igraph_layout_fruchterman_reingold(graph, coords.NativeInstance, initialCoords != null, niter, startTemp, igraph_layout_grid_t.IGRAPH_LAYOUT_AUTOGRID, null, null, null, null, null);
       return coords;
@@ -97,7 +97,7 @@
     }
     public Matrix LayoutWithKamadaKawai(int maxiter, double epsilon, double kkconst, Matrix initialCoords = null) {
-      if (initialCoords != null && (initialCoords.Rows != graph.n || initialCoords.Columns != 2))
+      if (initialCoords != null && (initialCoords.Rows != Vertices || initialCoords.Columns != 2))
         throw new ArgumentException("Initial coordinate matrix does not contain the required number of rows and columns.", "initialCoords");
-      var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix(graph.n, 2);
+      var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix(Vertices, 2);
       DllImporter.igraph_layout_kamada_kawai(graph, coords.NativeInstance, initialCoords != null, maxiter, epsilon, kkconst, null, null, null, null, null);
       return coords;
@@ -109,8 +109,25 @@
     }
     public Matrix LayoutWithDavidsonHarel(int maxiter, int fineiter, double cool_fact, double weight_node_dist, double weight_border, double weight_edge_lengths, double weight_edge_crossings, double weight_node_edge_dist, Matrix initialCoords = null) {
-      if (initialCoords != null && (initialCoords.Rows != graph.n || initialCoords.Columns != 2))
+      if (initialCoords != null && (initialCoords.Rows != Vertices || initialCoords.Columns != 2))
         throw new ArgumentException("Initial coordinate matrix does not contain the required number of rows and columns.", "initialCoords");
-      var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix(graph.n, 2);
+      var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix(Vertices, 2);
       DllImporter.igraph_layout_davidson_harel(graph, coords.NativeInstance, initialCoords != null, maxiter, fineiter, cool_fact, weight_node_dist, weight_border, weight_edge_lengths, weight_edge_crossings, weight_node_edge_dist);
+      return coords;
+    }
+
+    /// <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;
     }
Index: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Matrix.cs
===================================================================
--- trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Matrix.cs	(revision 14244)
+++ trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Matrix.cs	(revision 14245)
@@ -39,4 +39,16 @@
       DllImporter.igraph_matrix_copy(matrix, other.NativeInstance);
     }
+    public Matrix(double[,] mat) {
+      if (mat == null) throw new ArgumentNullException("mat");
+      matrix = new igraph_matrix_t();
+      var nrows = mat.GetLength(0);
+      var ncols = mat.GetLength(1);
+      DllImporter.igraph_matrix_init(matrix, nrows, ncols);
+      var colwise = new double[ncols * nrows];
+      for (var j = 0; j < ncols; j++)
+        for (var i = 0; i < nrows; i++)
+          colwise[j * nrows + i] = mat[i, j];
+      DllImporter.igraph_vector_init_copy(matrix.data, colwise);
+    }
     ~Matrix() {
       DllImporter.igraph_matrix_destroy(matrix);
@@ -48,4 +60,16 @@
       matrix = null;
       GC.SuppressFinalize(this);
+    }
+
+    public void Fill(double v) {
+      DllImporter.igraph_matrix_fill(matrix, v);
+    }
+
+    public void Transpose() {
+      DllImporter.igraph_matrix_transpose(matrix);
+    }
+
+    public void Scale(double by) {
+      DllImporter.igraph_matrix_scale(matrix, by);
     }
 
Index: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Vector.cs
===================================================================
--- trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Vector.cs	(revision 14244)
+++ trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Vector.cs	(revision 14245)
@@ -21,4 +21,6 @@
 
 using System;
+using System.Collections.Generic;
+using System.Linq;
 
 namespace HeuristicLab.IGraph.Wrappers {
@@ -39,5 +41,10 @@
       DllImporter.igraph_vector_init(vector, length);
     }
-
+    public Vector(IEnumerable<double> data) {
+      if (data == null) throw new ArgumentNullException("data");
+      var vec = data.ToArray();
+      vector = new igraph_vector_t();
+      DllImporter.igraph_vector_init_copy(vector, vec);
+    }
     public Vector(Vector other) {
       if (other == null) throw new ArgumentNullException("other");
@@ -45,5 +52,4 @@
       DllImporter.igraph_vector_copy(vector, other.NativeInstance);
     }
-
     ~Vector() {
       DllImporter.igraph_vector_destroy(vector);
@@ -55,4 +61,20 @@
       vector = null;
       GC.SuppressFinalize(this);
+    }
+
+    public void Fill(double v) {
+      DllImporter.igraph_vector_fill(vector, v);
+    }
+
+    public void Reverse() {
+      DllImporter.igraph_vector_reverse(vector);
+    }
+
+    public void Shuffle() {
+      DllImporter.igraph_vector_shuffle(vector);
+    }
+
+    public void Scale(double by) {
+      DllImporter.igraph_vector_scale(vector, by);
     }
 
@@ -69,9 +91,5 @@
 
     public double[] ToArray() {
-      var result = new double[Length];
-      for (var i = 0; i < result.Length; i++) {
-        result[i] = DllImporter.igraph_vector_e(vector, i);
-      }
-      return result;
+      return DllImporter.igraph_vector_to_array(vector);
     }
   }
