how to find the cardinality of neighbors of a set of vertices in a graph by using sagemath?
I am having list of dominating sets of a simple graph G. I need to find the cardinality of neighbors of each dominating sets. For that, first i want to know that how to find cardinality of neighbors of a set of vertices of of G by using sagemath.
Recall the definition of a dominating set. If
Dis a dominating set of a graphG=(V,E), then for each vertexu\in V, eitheruis inDor it is a neighbor of a vertex inD. I assume that you are interested in the strict neighborhood ofD, that is the set of vertices that are neighbors of a vertex inDbut are not inD. Obviously, it'sV-Dand the cardinality of this set is obvious to deduce.