A weighted graph (G,w) is a graph G=(V,E) together with a weight function on its vertices . We consider the maximal (minimal) number of edges in a spanning subgraph H of G with for all v∈V. For these parameters and their corresponding duals we prove—among other results—generalizations of the well-known theorems of König (Mat. Fiz. Lapok 38 (1931) 116–119) and Gallai (Ann. Univ. Sci. Budapest. Eötvös Sect. Math. 2 (1959) 133–138). Note that these notions naturally generalize maximum matchings and minimum edge covers in graphs.