Remap Node Identifier#
The Remap Node Identifier operation can be utilized to remap the id field of nodes
in a graph.
The main entry point is the kgx.graph_operations.remap_node_identifier method that
takes an instance of kgx.graph.base_graph.BaseGraph along with a category,
alternative_property, and prefix as arguments.
kgx.graph_operations.remap_node_identifier#
- kgx.graph_operations.remap_node_identifier(graph: BaseGraph, category: str, alternative_property: str, prefix=None) BaseGraph[source]#
Remap a node’s ‘id’ attribute with value from a node’s
alternative_propertyattribute.- Parameters:
graph (kgx.graph.base_graph.BaseGraph) – The graph
category (string) – category referring to nodes whose ‘id’ needs to be remapped
alternative_property (string) – property name from which the new value is pulled from
prefix (string) – signifies that the value for
alternative_propertyis a list and theprefixindicates which value to pick from the list
- Returns:
The modified graph
- Return type: