3
$\begingroup$

I have a problem when I want to see values of edges on my weight graph.

Z = Graph[{"A" -> "B","A" -> "B"}, EdgeWeight -> {5, 200}, EdgeLabels -> "EdgeWeight"]

The both values displayed on my graph are 5 and not 5 and 200

Have you some idea why?

$\endgroup$
2
  • 1
    $\begingroup$ Your graph has 2 identical edges, and adding different weights to them was not supported until version 12.1. In 12.1 you can use {DirectedEdge["A", "B", 1], DirectedEdge["A", "B", 2]} as your edge list and it works. $\endgroup$
    – Jason B.
    Jul 21, 2020 at 21:58
  • 1
    $\begingroup$ OK I don't know it was not supported...I try and it works Thanks @Jason B $\endgroup$ Jul 21, 2020 at 22:13

1 Answer 1

4
$\begingroup$

In versions 12.1+, you can use EdgeTaggedGraph:

EdgeTaggedGraph[{"A" -> "B", "A" -> "B"}, 
 EdgeWeight -> {5, 200}, EdgeLabels -> "EdgeWeight"]

enter image description here

$\endgroup$

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