Added the method to find the isolated nodes in the graph

This commit is contained in:
Shivam Arora 2018-10-31 16:14:30 +05:30
parent 506172279a
commit 1a5df6bc46

View File

@ -279,3 +279,12 @@ def krusk(E_and_n):
s[j].update(s[i])
s.pop(i)
break
# find the isolated node in the graph
def find_isolated_nodes(graph):
isolated = []
for node in graph:
if not graph[node]:
isolated.append(node)
return isolated