layout_with_mds | R Documentation |
Multidimensional scaling of some distance matrix defined on the vertices of a graph.
layout_with_mds(graph, dist = NULL, dim = 2, options = arpack_defaults())
with_mds(...)
graph |
The input graph. |
dist |
The distance matrix for the multidimensional scaling. If
|
dim |
|
options |
This is currently ignored, as ARPACK is not used any more for solving the eigenproblem |
... |
Passed to |
layout_with_mds()
uses classical multidimensional scaling (Torgerson scaling)
for generating the coordinates. Multidimensional scaling aims to place points
from a higher dimensional space in a (typically) 2 dimensional plane, so that
the distances between the points are kept as much as this is possible.
By default igraph uses the shortest path matrix as the distances between the
nodes, but the user can override this via the dist
argument.
Warning: If the graph is symmetric to the exchange of two vertices (as is the case with leaves of a tree connecting to the same parent), classical multidimensional scaling may assign the same coordinates to these vertices.
This function generates the layout separately for each graph component and
then merges them via merge_coords()
.
A numeric matrix with dim
columns.
Tamas Nepusz ntamas@gmail.com and Gabor Csardi csardi.gabor@gmail.com
Cox, T. F. and Cox, M. A. A. (2001) Multidimensional Scaling. Second edition. Chapman and Hall.
layout()
, plot.igraph()
Other graph layouts:
add_layout_()
,
component_wise()
,
layout_()
,
layout_as_bipartite()
,
layout_as_star()
,
layout_as_tree()
,
layout_in_circle()
,
layout_nicely()
,
layout_on_grid()
,
layout_on_sphere()
,
layout_randomly()
,
layout_with_dh()
,
layout_with_fr()
,
layout_with_gem()
,
layout_with_graphopt()
,
layout_with_kk()
,
layout_with_lgl()
,
layout_with_sugiyama()
,
merge_coords()
,
norm_coords()
,
normalize()
g <- sample_gnp(100, 2 / 100)
l <- layout_with_mds(g)
plot(g, layout = l, vertex.label = NA, vertex.size = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.