Remove Singleton Nodes#
The Remove Singleton Nodes operation can be used to remove all nodes in the graph that
has a degree of 0
. i.e. they are not participating in any edges.
This operation is typically useful for pruning graphs with isolated nodes before using them in machine learning workflows.
kgx.graph_operations.remove_singleton_nodes#
- kgx.graph_operations.remove_singleton_nodes(graph: BaseGraph) None [source]#
Remove singleton nodes (nodes that have a degree of 0) from the graph.
- Parameters:
graph (kgx.graph.base_graph.BaseGraph) – The graph