Bug in NearestNeighborGraph

Bug in NearestNeighborGraph



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


NearestNeighborGraph


$Version



11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)


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



enter image description here



Is there a workaround?




2 Answers
2



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



For another workaround, you can set ImageSize:


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



enter image description here



Thanks for contributing an answer to Mathematica Stack Exchange!



But avoid



Use MathJax to format equations. MathJax reference.



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




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