Tag Info

New answers tagged

1

For V9 and up. (you haven't specified your version in your question) g = CompleteGraph[4]; PropertyValue[{g, UndirectedEdge[1, 2]}, EdgeWeight] = 2; MatrixForm@Normal@WeightedAdjacencyMatrix[g] $\left( \begin{array}{cccc} 0 & 2 & 1 & 1 \\ 2 & 0 & 1 & 1 \\ 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & 0 \\ \end{array} ...


1

I'm not sure I quite understand what you intend to do with EdgeAdd thus I will only answer the "I want to modify the edge 1-4 of the CompleteGraph[5]" question. Here I modify the edge 1 <-> 4 and 1 <-> 2 for generalisation purposes: g = CompleteGraph[5]; weightsVal = {a, b}; (* in the same order as {1 <-> 4, 1 <-> 2}*) weights = ...



Top 50 recent answers are included