The article is devoted to the search for solutions to optimize multiservice network traffic taking according the switching matrix by increasing the capabilities of network equipment with restrictions on their number with the ability to implement the algorithm as a Virtual Network Function for a Software-Defined Network. It is assumed that the networks are represented by an undirected complete connected planar graph.