To use MaximalIndependentVertexSet, you first need to load the Graph Utilities Package using Needs["GraphUtilities`"].
MaximalIndependentVertexSet gives an (approximate) maximal set of vertices such that no two vertices form an edge. It treats the input as an undirected graph.
The length of the vector w must be the same as the number of vertices in g.