# SubGraphs on basis of Node Degree

Hello Everybody,

While using R and igraph, how do I induce Sub Graphs on the basis of Node Degree?
Some thing like a graph of all nodes and edges with node degrees less that say 5

Thanks in anticipation

SHRINIVAS

Are you looking for a k-core decomposition?

If so, use the `coreness()` function to find the coreness of each vertex. Select vertices with coreness \ge k for your chosen k, take the corresponding induced subgraph and look for connected components.

Thank you Sir for the prompt response

My Graph has the following Degree distribution
1 2 3 4 5 6 7 8 9 10 11 12 14 25 31
105 30 27 16 33 9 5 4 2 3 2 1 2 1 1
I want to create separate graphs for Degree 1 ( 105 vertices), upto degree 31 with 1 vertex.

Regards

SHRINIVAS

Hi Dharma,
“Separate graphs” may require clarification.

• Do you mean one graph for each vertex, i.e., ego graphs?
• Do you want one graph with all the degree 1 nodes, one graph with all the degree 2 nodes, etc.? And this includes the nodes they connect to? Then the first graph is the union of the ego graphs for nodes of degree 1; the second graph the union of the ego graphs for nodes of degree 2, etc. Low degree nodes may connect to high degree nodes, which would then be included in the graph.
• Or do you mean all the degree 1 nodes but only including neighbor vertices that are also degree 1 in the original graph; all the degree 2 nodes and only including degree 2 neighbors; etc.? Then nodes may have lower degree in the produced graphs.

Dan Suthers

You should clarify if k-cores was what you meant.

Once you take a subgraph, the degrees change (since part of the original graph is excluded). k-cores consider the degrees in the subgraph. If you want to consider the degrees in the original graph, that a different problem, but a fairly trivial one: just remove small degree nodes (something like `delete_vertices(g, V(G)[degree(g) < threshold])`).