# Assign vertex label as vertex value without changing edgeWeight [closed]

I am new to Mathematica. I have drawn a node graph, which has approximate 600 vertices and specific edge weight (as shown below). There is a vertex label in each vertex. I want to assign vertex label as a vertex value. I can do it by this.

rplcmntRule = VertexLabels /. Options[g]
newVertices = VertexList[g] /. rplcmntRule;
newEdges = EdgeList[g] /. rplcmntRule
g = Graph[newEdges, VertexLabels -> Placed["Name", {1/2, 1/2}]]


But this method also changes the edge weight. I want to change the vertex only, without changing the edge weight.

You can rename vertices using the VertexReplace function. It will preserve edge weights.
• @Salahuddin With a clearer mind in the morning, I think I see what you mean. Those are not edge weights. They are edge labels. They cannot be used in computation. The EdgeWeight property does get correctly preserved (unlike the EdgeLabels property). It would help if you have a complete and correct example in your next question (see sscce.org) – Szabolcs Aug 16 '17 at 7:03