I'm trying to make a program to illustrate the simplify process of a complex resistence network. I create a graph to represent the structure of the network and trying to use EdgeWeight to symbolize the value of resistence. but sometimes I'll need to deal with parallel resistence, so assigning EdgeWeight to them will be a problem.
In simple graphs, one can use:
gg=Graph[{1<->2,2<->3,3<->1},EdgeWeight->{1,2,3}]
to specify the weight of each edge. Then we can use PropertyValue to extract them:
PropertyValue[{gg,#},EdgeWeight]&/@EdgeList@gg
{1,2,3}
But in a non-simple graph:
gg=Graph[{1<->2,1<->2,2<->3},EdgeWeight->{1,2,3}]
It seems that EdgeWeight simply ignored the weight assignment for parallel edges and consider all parallel edges to be the same:
PropertyValue[{gg, #}, EdgeWeight] & /@ EdgeList@gg
{1,1,3}
This put a great barrier on my programming, so how to solve this problem? How to allow multiple EdgeWeight assigned to parallel edges?
Graph. I would consider this a bug. If it is a problem for you, it would be good if you could report it to Wolfram Support. People have suggested it several times that the number of times an issue is reported is taken into account when Wolfram prioritizes it. So please report it, even if Wolfram is aware of the problem. – Szabolcs Aug 18 '16 at 13:56Edgeweights and have replace functions when using the weights? – Feyre Aug 18 '16 at 14:55EdgeWeightbe, say,r1, and when you call theEdgeweights, depending on how it is called letr1be replaced by either1or2. – Feyre Aug 18 '16 at 15:09