Index: branches/symbreg-factors-2650/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/DllImporter.cs
===================================================================
--- branches/symbreg-factors-2650/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/DllImporter.cs	(revision 14239)
+++ branches/symbreg-factors-2650/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/DllImporter.cs	(revision 14276)
@@ -23,12 +23,12 @@
 using System.Runtime.InteropServices;
 
-namespace HeuristicLab.igraph {
+namespace HeuristicLab.IGraph {
   internal static class DllImporter {
     private const string X86Dll = "igraph-0.8.0-pre-x86.dll";
     private const string X64Dll = "igraph-0.8.0-pre-x64.dll";
-    private readonly static bool X64 = false;
+    private readonly static bool X86 = false;
 
     static DllImporter() {
-      X64 = Environment.Is64BitProcess;
+      X86 = !Environment.Is64BitProcess;
     }
 
@@ -36,9 +36,9 @@
     #region igraph init/finalize
     internal static void igraph_empty(igraph_t graph, int n, bool directed) {
-      if (X64) igraph_empty_x64(graph, n, directed);
-      else igraph_empty_x86(graph, n, directed);
+      if (X86) igraph_empty_x86(graph, n, directed);
+      else igraph_empty_x64(graph, n, directed);
     }
     internal static int igraph_destroy(igraph_t graph) {
-      return X64 ? igraph_destroy_x64(graph) : igraph_destroy_x86(graph);
+      return X86 ? igraph_destroy_x86(graph) : igraph_destroy_x64(graph);
     }
     #endregion
@@ -46,5 +46,61 @@
     #region igraph query
     internal static int igraph_vcount(igraph_t graph) {
-      return X64 ? igraph_vcount_x64(graph) : igraph_vcount_x86(graph);
+      return X86 ? igraph_vcount_x86(graph) : igraph_vcount_x64(graph);
+    }
+    #endregion
+
+    #region igraph characteristics
+    internal static int igraph_density(igraph_t graph, out double density, bool loops) {
+      density = double.NaN;
+      return X86 ? igraph_density_x86(graph, ref density, loops) : igraph_density_x64(graph, ref density, loops);
+    }
+
+    internal static int igraph_pagerank(igraph_t graph, igraph_pagerank_algo_t algo, igraph_vector_t vector, out double value, igraph_vs_t vids, bool directed, double damping, igraph_vector_t weights) {
+      value = 1;
+      var options = IntPtr.Zero;
+      if (algo == igraph_pagerank_algo_t.IGRAPH_PAGERANK_ALGO_ARPACK) {
+        var arpackoptions = GetDefaultArpackOptions();
+        options = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(igraph_arpack_options_t)));
+        Marshal.StructureToPtr(arpackoptions, options, false);
+      } else if (algo == igraph_pagerank_algo_t.IGRAPH_PAGERANK_ALGO_POWER) {
+        var poweroptions = GetDefaultPowerOptions();
+        options = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(igraph_pagerank_power_options_t)));
+        Marshal.StructureToPtr(poweroptions, options, false);
+      }
+      try {
+        return X86 ? igraph_pagerank_x86(graph, algo, vector, ref value, vids, directed, damping, weights, options) : igraph_pagerank_x64(graph, algo, vector, ref value, vids, directed, damping, weights, options);
+      } finally {
+        if (algo == igraph_pagerank_algo_t.IGRAPH_PAGERANK_ALGO_ARPACK) {
+          Marshal.DestroyStructure(options, typeof(igraph_arpack_options_t));
+          Marshal.FreeHGlobal(options);
+        } else if (algo == igraph_pagerank_algo_t.IGRAPH_PAGERANK_ALGO_POWER) {
+          Marshal.DestroyStructure(options, typeof(igraph_pagerank_power_options_t));
+          Marshal.FreeHGlobal(options);
+        }
+      }
+    }
+
+    unsafe private static igraph_arpack_options_t GetDefaultArpackOptions() {
+      var arpackoptions = new igraph_arpack_options_t();
+      arpackoptions.bmat[0] = 'I';
+      arpackoptions.which[0] = arpackoptions.which[1] = 'X';
+      arpackoptions.nev = 1;
+      arpackoptions.ishift = 1;
+      arpackoptions.mxiter = 3000;
+      arpackoptions.nb = 1;
+      arpackoptions.mode = 1;
+      arpackoptions.iparam[0] = arpackoptions.ishift;
+      arpackoptions.iparam[1] = arpackoptions.iparam[4] = arpackoptions.iparam[5] = arpackoptions.iparam[7] = arpackoptions.iparam[8] = arpackoptions.iparam[9] = arpackoptions.iparam[10] = 0;
+      arpackoptions.iparam[2] = arpackoptions.mxiter;
+      arpackoptions.iparam[3] = arpackoptions.nb;
+      arpackoptions.iparam[6] = arpackoptions.mode;
+      return arpackoptions;
+    }
+
+    private static igraph_pagerank_power_options_t GetDefaultPowerOptions() {
+      var poweroptions = new igraph_pagerank_power_options_t();
+      poweroptions.niter = 50;
+      poweroptions.eps = 1e-5;
+      return poweroptions;
     }
     #endregion
@@ -52,5 +108,5 @@
     #region igraph manipulation
     internal static int igraph_add_edge(igraph_t graph, int from, int to) {
-      return X64 ? igraph_add_edge_x64(graph, from, to) : igraph_add_edge_x86(graph, from, to);
+      return X86 ? igraph_add_edge_x86(graph, from, to) : igraph_add_edge_x64(graph, from, to);
     }
     #endregion
@@ -73,4 +129,12 @@
     [DllImport(X64Dll, EntryPoint = "igraph_add_edge", CallingConvention = CallingConvention.Cdecl)]
     private static extern int igraph_add_edge_x64([In, Out]igraph_t graph, int from, int to);
+    [DllImport(X86Dll, EntryPoint = "igraph_density", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_density_x86(igraph_t graph, ref double density, bool loops);
+    [DllImport(X64Dll, EntryPoint = "igraph_density", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_density_x64(igraph_t graph, ref double density, bool loops);
+    [DllImport(X86Dll, EntryPoint = "igraph_pagerank", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_pagerank_x86(igraph_t graph, igraph_pagerank_algo_t algo, [In, Out]igraph_vector_t vector, ref double value, igraph_vs_t vids, bool directed, double damping, igraph_vector_t weights, IntPtr options);
+    [DllImport(X64Dll, EntryPoint = "igraph_pagerank", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_pagerank_x64(igraph_t graph, igraph_pagerank_algo_t algo, [In, Out]igraph_vector_t vector, ref double value, igraph_vs_t vids, bool directed, double damping, igraph_vector_t weights, IntPtr options);
     #endregion
     #endregion
@@ -78,8 +142,8 @@
     #region igraph_rng
     internal static int igraph_rng_get_integer(int l, int h) {
-      return X64 ? igraph_rng_get_integer_x64(igraph_rng_default_x64(), l, h) : igraph_rng_get_integer_x86(igraph_rng_default_x86(), l, h);
+      return X86 ? igraph_rng_get_integer_x86(igraph_rng_default_x86(), l, h) : igraph_rng_get_integer_x64(igraph_rng_default_x64(), l, h);
     }
     internal static int igraph_rng_seed(uint seed) {
-      return X64 ? igraph_rng_seed_x64(igraph_rng_default_x64(), seed) : igraph_rng_seed_x86(igraph_rng_default_x86(), seed);
+      return X86 ? igraph_rng_seed_x86(igraph_rng_default_x86(), seed) : igraph_rng_seed_x64(igraph_rng_default_x64(), seed);
     }
 
@@ -100,20 +164,76 @@
     #endregion
 
+    #region igraph_vector
+    internal static int igraph_vector_init(igraph_vector_t vector, int length) {
+      return X86 ? igraph_vector_init_x86(vector, length) : igraph_vector_init_x64(vector, length);
+    }
+    internal static void igraph_vector_destroy(igraph_vector_t vector) {
+      if (X86) igraph_vector_destroy_x86(vector);
+      else igraph_vector_destroy_x64(vector);
+    }
+    internal static int igraph_vector_copy(igraph_vector_t to, igraph_vector_t from) {
+      return X86 ? igraph_vector_copy_x86(to, from) : igraph_vector_copy_x64(to, from);
+    }
+
+    internal static int igraph_vector_size(igraph_vector_t vector) {
+      return X86 ? igraph_vector_size_x86(vector) : igraph_vector_size_x64(vector);
+    }
+
+    internal static double igraph_vector_e(igraph_vector_t vector, int index) {
+      return X86 ? igraph_vector_e_x86(vector, index) : igraph_vector_e_x64(vector, index);
+    }
+
+    internal static void igraph_vector_set(igraph_vector_t vector, int index, double value) {
+      if (X86) igraph_vector_set_x86(vector, index, value);
+      else igraph_vector_set_x64(vector, index, value);
+    }
+
+    #region Platform specific DLL imports
+    [DllImport(X86Dll, EntryPoint = "igraph_vector_init", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_init_x86([In, Out]igraph_vector_t vector, int length);
+    [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_destroy", CallingConvention = CallingConvention.Cdecl)]
+    private static extern void igraph_vector_destroy_x86([In, Out]igraph_vector_t vector);
+    [DllImport(X64Dll, EntryPoint = "igraph_vector_destroy", CallingConvention = CallingConvention.Cdecl)]
+    private static extern void igraph_vector_destroy_x64([In, Out]igraph_vector_t vector);
+    [DllImport(X86Dll, EntryPoint = "igraph_vector_size", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_size_x86(igraph_vector_t vector);
+    [DllImport(X64Dll, EntryPoint = "igraph_vector_size", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_size_x64(igraph_vector_t vector);
+    [DllImport(X86Dll, EntryPoint = "igraph_vector_e", CallingConvention = CallingConvention.Cdecl)]
+    private static extern double igraph_vector_e_x86(igraph_vector_t vector, int index);
+    [DllImport(X64Dll, EntryPoint = "igraph_vector_e", CallingConvention = CallingConvention.Cdecl)]
+    private static extern double igraph_vector_e_x64(igraph_vector_t vector, int index);
+    [DllImport(X86Dll, EntryPoint = "igraph_vector_set", CallingConvention = CallingConvention.Cdecl)]
+    private static extern double igraph_vector_set_x86([In, Out]igraph_vector_t vector, int index, double value);
+    [DllImport(X64Dll, EntryPoint = "igraph_vector_set", CallingConvention = CallingConvention.Cdecl)]
+    private static extern double igraph_vector_set_x64([In, Out]igraph_vector_t vector, int index, double value);
+    [DllImport(X86Dll, EntryPoint = "igraph_vector_copy", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vector_copy_x86([In, Out]igraph_vector_t to, igraph_vector_t from);
+    [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);
+    #endregion
+    #endregion
+
     #region igraph_matrix
     internal static int igraph_matrix_init(igraph_matrix_t matrix, int nrows, int ncols) {
-      return X64 ? igraph_matrix_init_x64(matrix, nrows, ncols) : igraph_matrix_init_x86(matrix, nrows, ncols);
+      return X86 ? igraph_matrix_init_x86(matrix, nrows, ncols) : igraph_matrix_init_x64(matrix, nrows, ncols);
     }
     internal static void igraph_matrix_destroy(igraph_matrix_t matrix) {
-      if (X64) igraph_matrix_destroy_x64(matrix);
-      else igraph_matrix_destroy_x86(matrix);
+      if (X86) igraph_matrix_destroy_x86(matrix);
+      else igraph_matrix_destroy_x64(matrix);
+    }
+    internal static int igraph_matrix_copy(igraph_matrix_t to, igraph_matrix_t from) {
+      return X86 ? igraph_matrix_copy_x86(to, from) : igraph_matrix_copy_x64(to, from);
     }
 
     internal static double igraph_matrix_e(igraph_matrix_t matrix, int row, int col) {
-      return X64 ? igraph_matrix_e_x64(matrix, row, col) : igraph_matrix_e_x86(matrix, row, col);
+      return X86 ? igraph_matrix_e_x86(matrix, row, col) : igraph_matrix_e_x64(matrix, row, col);
     }
 
     internal static void igraph_matrix_set(igraph_matrix_t matrix, int row, int col, double value) {
-      if (X64) igraph_matrix_set_x64(matrix, row, col, value);
-      else igraph_matrix_set_x86(matrix, row, col, value);
+      if (X86) igraph_matrix_set_x86(matrix, row, col, value);
+      else igraph_matrix_set_x64(matrix, row, col, value);
     }
 
@@ -132,7 +252,11 @@
     private static extern double igraph_matrix_e_x64(igraph_matrix_t matrix, int row, int col);
     [DllImport(X86Dll, EntryPoint = "igraph_matrix_set", CallingConvention = CallingConvention.Cdecl)]
-    private static extern double igraph_matrix_set_x86(igraph_matrix_t matrix, int row, int col, double value);
+    private static extern double igraph_matrix_set_x86([In, Out]igraph_matrix_t matrix, int row, int col, double value);
     [DllImport(X64Dll, EntryPoint = "igraph_matrix_set", CallingConvention = CallingConvention.Cdecl)]
-    private static extern double igraph_matrix_set_x64(igraph_matrix_t matrix, int row, int col, double value);
+    private static extern double igraph_matrix_set_x64([In, Out]igraph_matrix_t matrix, int row, int col, double value);
+    [DllImport(X86Dll, EntryPoint = "igraph_matrix_copy", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_matrix_copy_x86([In, Out]igraph_matrix_t to, igraph_matrix_t from);
+    [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);
     #endregion
     #endregion
@@ -140,5 +264,11 @@
     #region igraph_layout
     internal static int igraph_layout_fruchterman_reingold(igraph_t graph, igraph_matrix_t res, bool use_seed, int niter, double start_temp, igraph_layout_grid_t grid, igraph_vector_t weights, igraph_vector_t minx, igraph_vector_t maxx, igraph_vector_t miny, igraph_vector_t maxy) {
-      return X64 ? igraph_layout_fruchterman_reingold_x64(graph, res, use_seed, niter, start_temp, grid, weights, minx, maxx, miny, maxy) : igraph_layout_fruchterman_reingold_x86(graph, res, use_seed, niter, start_temp, grid, weights, minx, maxx, miny, maxy);
+      return X86 ? igraph_layout_fruchterman_reingold_x86(graph, res, use_seed, niter, start_temp, grid, weights, minx, maxx, miny, maxy) : igraph_layout_fruchterman_reingold_x64(graph, res, use_seed, niter, start_temp, grid, weights, minx, maxx, miny, maxy);
+    }
+    internal static int igraph_layout_kamada_kawai(igraph_t graph, igraph_matrix_t res, bool use_seed, int maxiter, double epsilon, double kkconst, igraph_vector_t weights, igraph_vector_t minx, igraph_vector_t maxx, igraph_vector_t miny, igraph_vector_t maxy) {
+      return X86 ? igraph_layout_kamada_kawai_x86(graph, res, use_seed, maxiter, epsilon, kkconst, weights, minx, maxx, miny, maxy) : igraph_layout_kamada_kawai_x64(graph, res, use_seed, maxiter, epsilon, kkconst, weights, minx, maxx, miny, maxy);
+    }
+    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);
     }
 
@@ -148,7 +278,35 @@
     [DllImport(X64Dll, EntryPoint = "igraph_layout_fruchterman_reingold", CallingConvention = CallingConvention.Cdecl)]
     private static extern int igraph_layout_fruchterman_reingold_x64(igraph_t graph, [In, Out]igraph_matrix_t res, bool use_seed, int niter, double start_temp, igraph_layout_grid_t grid, igraph_vector_t weights, igraph_vector_t minx, igraph_vector_t maxx, igraph_vector_t miny, igraph_vector_t maxy);
-    #endregion
-    #endregion
-
+    [DllImport(X86Dll, EntryPoint = "igraph_layout_kamada_kawai", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_layout_kamada_kawai_x86(igraph_t graph, [In, Out]igraph_matrix_t res, bool use_seed, int maxiter, double epsilon, double kkconst, igraph_vector_t weights, igraph_vector_t minx, igraph_vector_t maxx, igraph_vector_t miny, igraph_vector_t maxy);
+    [DllImport(X64Dll, EntryPoint = "igraph_layout_kamada_kawai", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_layout_kamada_kawai_x64(igraph_t graph, [In, Out]igraph_matrix_t res, bool use_seed, int maxiter, double epsilon, double kkconst, igraph_vector_t weights, igraph_vector_t minx, igraph_vector_t maxx, igraph_vector_t miny, igraph_vector_t maxy);
+    [DllImport(X86Dll, EntryPoint = "igraph_layout_davidson_harel", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_layout_davidson_harel_x86(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(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);
+    #endregion
+    #endregion
+
+    #region igraph_iterators
+    internal static int igraph_vs_all(ref igraph_vs_t vs) {
+      return X86 ? igraph_vs_all_x86(ref vs) : igraph_vs_all_x64(ref vs);
+    }
+    internal static void igraph_vs_destroy(ref igraph_vs_t vs) {
+      if (X86) igraph_vs_destroy_x86(ref vs);
+      else igraph_vs_destroy_x64(ref vs);
+    }
+
+    #region Platform specific DLL imports
+    [DllImport(X86Dll, EntryPoint = "igraph_vs_all", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vs_all_x86([In, Out]ref igraph_vs_t vs);
+    [DllImport(X64Dll, EntryPoint = "igraph_vs_all", CallingConvention = CallingConvention.Cdecl)]
+    private static extern int igraph_vs_all_x64([In, Out]ref igraph_vs_t vs);
+    [DllImport(X86Dll, EntryPoint = "igraph_vs_destroy", CallingConvention = CallingConvention.Cdecl)]
+    private static extern void igraph_vs_destroy_x86([In, Out]ref igraph_vs_t vs);
+    [DllImport(X64Dll, EntryPoint = "igraph_vs_destroy", CallingConvention = CallingConvention.Cdecl)]
+    private static extern void igraph_vs_destroy_x64([In, Out]ref igraph_vs_t vs);
+    #endregion
+    #endregion
   }
 }
