graph - Mathematica GraphPlot 与图像

标签 graph wolfram-mathematica

我正在尝试使用 GraphPlot函数构建 Graph ,其中每个节点是一个图像。我想将图像显示为我的顶点。有人知道怎么做这个吗?

我试过这样的事情:

GraphPlot[  Map[If[# > 2.0 , 0, 1] &,
 imgDistT, {2}],  
 VertexRenderingFunction -> (Inset[imgs[[#2]], #1, Center] &) ]

但这不起作用。
imgs 是我与每个顶点编号对应的图像列表。

作为健全性检查,如果我这样做:
GraphPlot[
 Map[If[# > 2.0 , 0, 1] &, imgDistT, {2}], 
 VertexRenderingFunction -> (Inset[Text[#2], #1, Center] &) ]

然后就可以了,它向我显示了每个节点的顶​​点数。

最佳答案

 imgs = ExampleData /@ ExampleData["TestImage"];
 GraphPlot[{1 -> 4, 1 -> 5, 2 -> 3, 2 -> 4, 2 -> 5, 3 -> 4, 3 -> 5}, 
   VertexRenderingFunction -> (Inset[Image[imgs[[#2]], ImageSize -> 100], #1] &)]

enter image description here

编辑

-- 删除了中缀符号笑话-

关于graph - Mathematica GraphPlot 与图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/885910/

相关文章:

wolfram-mathematica - 如何为符号设置值

wolfram-mathematica - 单个单元格的计数器增量

if-statement - 一般来说,用一对嵌套的 IF 替换 AND 会加快速度吗?

wolfram-mathematica - Maxima 在相对简单的积分上崩溃

r - R 中带导数的标签轴

python绘制多图

algorithm - 完全加权图G,求权值和一机

algorithm - 无向图和城市电源路径

algorithm - 在不影响图的最小生成树的情况下添加尽可能轻的边?

file - 如何在 Mathematica 中将 .dat 文件作为矩阵导入?