That will depend on how you want to provide the weight value. Do you want to calculate it based on some formula (like, for example, the number of adjacent vertices)? Do you want to specify it manually, as in prompting the user to enter the value? Read it in from some other source?
The answer to your question, basically, depends on how you wish to implement it.