Changeset 14245 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Graph.cs
- Timestamp:
- 08/08/16 23:36:49 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Igraph/0.8.0-pre/HeuristicLab.Igraph-0.8.0-pre/Wrappers/Graph.cs
r14244 r14245 86 86 } 87 87 public Matrix LayoutWithFruchtermanReingold(int niter, double startTemp, Matrix initialCoords = null) { 88 if (initialCoords != null && (initialCoords.Rows != graph.n|| initialCoords.Columns != 2))88 if (initialCoords != null && (initialCoords.Rows != Vertices || initialCoords.Columns != 2)) 89 89 throw new ArgumentException("Initial coordinate matrix does not contain the required number of rows and columns.", "initialCoords"); 90 var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix( graph.n, 2);90 var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix(Vertices, 2); 91 91 DllImporter.igraph_layout_fruchterman_reingold(graph, coords.NativeInstance, initialCoords != null, niter, startTemp, igraph_layout_grid_t.IGRAPH_LAYOUT_AUTOGRID, null, null, null, null, null); 92 92 return coords; … … 97 97 } 98 98 public Matrix LayoutWithKamadaKawai(int maxiter, double epsilon, double kkconst, Matrix initialCoords = null) { 99 if (initialCoords != null && (initialCoords.Rows != graph.n|| initialCoords.Columns != 2))99 if (initialCoords != null && (initialCoords.Rows != Vertices || initialCoords.Columns != 2)) 100 100 throw new ArgumentException("Initial coordinate matrix does not contain the required number of rows and columns.", "initialCoords"); 101 var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix( graph.n, 2);101 var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix(Vertices, 2); 102 102 DllImporter.igraph_layout_kamada_kawai(graph, coords.NativeInstance, initialCoords != null, maxiter, epsilon, kkconst, null, null, null, null, null); 103 103 return coords; … … 109 109 } 110 110 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) { 111 if (initialCoords != null && (initialCoords.Rows != graph.n|| initialCoords.Columns != 2))111 if (initialCoords != null && (initialCoords.Rows != Vertices || initialCoords.Columns != 2)) 112 112 throw new ArgumentException("Initial coordinate matrix does not contain the required number of rows and columns.", "initialCoords"); 113 var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix( graph.n, 2);113 var coords = initialCoords != null ? new Matrix(initialCoords) : new Matrix(Vertices, 2); 114 114 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); 115 return coords; 116 } 117 118 /// <summary> 119 /// Use multi-dimensional scaling to layout vertices. 120 /// A distance matrix can be used to specify the distances between the vertices. 121 /// Otherwise the distances will be calculated by shortest-path-length. 122 /// </summary> 123 /// <remarks> 124 /// For disconnected graphs, dimension must be 2. 125 /// </remarks> 126 /// <param name="dist">The distance matrix to layout the vertices.</param> 127 /// <param name="dim">How many dimensions should be used.</param> 128 /// <returns>The coordinates matrix of the aligned vertices.</returns> 129 public Matrix LayoutWithMds(Matrix dist = null, int dim = 2) { 130 var coords = new Matrix(Vertices, dim); 131 DllImporter.igraph_layout_mds(graph, coords.NativeInstance, dist != null ? dist.NativeInstance : null, dim); 115 132 return coords; 116 133 }
Note: See TracChangeset
for help on using the changeset viewer.