9
$\begingroup$

Update

Not fixed in 12.0.

NearestNeighborGraph generates incorrectly formatted output on rasterized input. Reported to Wolfram support CASE:4093797

$Version
(* "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)" *)

NearestNeighborGraph[
 Rasterize[Style[#, 20], "Image"] & /@ Alphabet[], 
 2,
 VertexLabels -> "Name"
]

enter image description here

The labels are too large.

Is there a workaround?

$\endgroup$
7
$\begingroup$

Assuming you are asking for a workaround, you can generate the output you expect with:

v = Style[#,20]& /@ Alphabet[];
rv = Rasterize/@v;

NearestNeighborGraph[
    rv,
    2,
    VertexLabels->Thread@Rule[rv,v]
]

enter image description here

$\endgroup$
1
$\begingroup$

For another workaround, you can set ImageSize:

NearestNeighborGraph[
 Rasterize[Style[#, 20], ImageSize -> 10] & /@ Alphabet[], 2, 
 VertexLabels -> Automatic]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.