Graph Wolfram Mathematica中图的着色边

Graph Wolfram Mathematica中图的着色边,graph,wolfram-mathematica,Graph,Wolfram Mathematica,在Wolfram Mathematica中,是否可以使用颜色函数对图形的边进行着色,这取决于边上的坐标?类似于在Plot[]中使用ColorFunction选项 我在图的边上指定了一个函数,这取决于边上的坐标。 是否可以在边缘绘制此函数的密度? 谢谢你的回复 PS:第一个想法-使用Inset[]在EdgeRenderingFunction中插入图形化的彩色对象,但这似乎很不自然。有没有简单的方法?使用颜色函数给图形中的边着色的一种方法是: ClearAll[colorededge]; c

在Wolfram Mathematica中,是否可以使用颜色函数对图形的边进行着色,这取决于边上的坐标?类似于在Plot[]中使用ColorFunction选项

我在图的边上指定了一个函数,这取决于边上的坐标。 是否可以在边缘绘制此函数的密度? 谢谢你的回复


PS:第一个想法-使用Inset[]在EdgeRenderingFunction中插入图形化的彩色对象,但这似乎很不自然。有没有简单的方法?

使用
颜色函数
给图形中的边着色的一种方法是:

  ClearAll[colorededge];
  colorededge[pts_, colorfunc_: Function[{x, y}, ColorData["TemperatureMap"][y]]] := 
  ListPlot[pts, Joined -> True, PlotStyle -> Thick, Axes -> False, 
  ColorFunction -> colorfunc, ColorFunctionScaling -> True];
  edgshpfnc = (If[Last[#2] == "B", First@colorededge[#1], 
  First@colorededge[#1, Function[{x, y}, Blend[{Yellow, Red}, x]]]] &);
  Graph[{"A" -> "B", "B" -> "C", "C" -> "A"}, 
  VertexCoordinates -> {"A" -> {0, 0}, "B" -> {1, 1}, "C" -> {2, 0}}, 
  EdgeShapeFunction -> edgshpfnc, VertexLabels -> "Name",  ImagePadding -> 10]
给予

给予


请考虑在专用站点上发布MMA相关问题以获得更好/更好/更快的答案。问题是,在EdgeShapeFunction /EdGeNeDRIN函数中使用的函数只需使用点阵的坐标作为参数,因此我们不能设置色调[]。取决于边缘的坐标。非常感谢-这正是我需要的。
 GraphPlot[{"A" -> "B", "B" -> "C", "C" -> "A"},
 EdgeRenderingFunction -> edgshpfnc, VertexLabeling -> True]