I am trying to figure out how to add a weighted directed edge to a graph, but am not having any success.
Say I have a graph defined as:
g1 = ; g1 = Graph[{2 \[DirectedEdge] 1, 3 \[DirectedEdge] 2,
4 \[DirectedEdge] 3, 4 \[DirectedEdge] 1},
EdgeWeight -> {2 \[DirectedEdge] 1 -> 2 + 5 I,
3 \[DirectedEdge] 2 -> 4 - 6 I, 4 \[DirectedEdge] 3 -> 1 + 8 I,
4 \[DirectedEdge] 1 -> 7 + 7 I}
];
There are 4 vertices (1, 2,3 and 4). With edges between 4->1, 4->3, 3->2, 2->1. The 4 edges have weights (Here I have complex numbers for the weights).
I would like to know how I can add another weighted, directed edge between vertices 3 and 1 and also specify the weight of this new directed edge.
I tried:
g1 = EdgeAdd[g1, DirectedEdge[3, 1, 5 + i]]
to add a new directed, weighted edge from Vertex 3 to Vertex 1, with a weight of 5 + 1 (a complex number) but to no avail.
Can someone provide a way to add new directed, weighted edges to a partially built graph as new directed edges are found when performing some computations?
Attachments: