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(...)
The input graph.
The distance matrix for the multidimensional scaling. If
NULL
(the default), then the unweighted shortest path matrix is used.
layout_with_mds
supports dimensions up to the number of nodes
minus one, but only if the graph is connected; for unconnected graphs, the
only possible values is 2. This is because merge_coords
only works in
2D.
This is currently ignored, as ARPACK is not used any more for solving the eigenproblem
Passed to layout_with_mds
.
A numeric matrix with dim
columns.
layout_with_mds
uses metric multidimensional 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 distance
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.
This function generates the layout separately for each graph component and
then merges them via merge_coords
.
Cox, T. F. and Cox, M. A. A. (2001) Multidimensional Scaling. Second edition. Chapman and Hall.
Other graph layouts: add_layout_
;
as_bipartite
,
layout.bipartite
,
layout_as_bipartite
; as_star
,
layout.star
, layout_as_star
;
as_tree
, layout_as_tree
;
component_wise
; in_circle
,
layout_in_circle
;
layout.auto
, layout_nicely
,
nicely
;
layout.davidson.harel
,
layout_with_dh
, with_dh
;
layout.gem
, layout_with_gem
,
with_gem
; layout.graphopt
,
layout_with_graphopt
,
with_graphopt
; layout.grid
,
layout.grid.3d
,
layout.grid.3d
,
layout_on_grid
, on_grid
;
layout.merge
,
layout_components
,
merge_coords
,
piecewise.layout
,
piecewise.layout
;
layout.norm
, norm_coords
;
layout.sugiyama
,
layout_with_sugiyama
,
with_sugiyama
;
layout_on_sphere
, on_sphere
;
layout_randomly
, randomly
;
layout_with_fr
, with_fr
;
layout_with_kk
, with_kk
;
layout_with_lgl
, with_lgl
;
layout
, layout_
,
print.igraph_layout_modifier
,
print.igraph_layout_spec
;
normalize
# NOT RUN {
g <- sample_gnp(100, 2/100)
l <- layout_with_mds(g)
plot(g, layout=l, vertex.label=NA, vertex.size=3)
# }
Run the code above in your browser using DataLab