def remove_attributes(hie, g_id, parent, node, json_attrs):
"""remove the attributes from json_attrs from the node"""
attrs = prim.json_dict_to_attrs(json_attrs)
if isinstance(hie.node[g_id], GraphNode):
lhs = nx.DiGraph()
lhs.add_node(node)
add_node_attrs(lhs, node, attrs)
ppp = nx.DiGraph()
ppp.add_node(node)
rhs = nx.DiGraph()
rhs.add_node(node)
rule = Rule(ppp, lhs, rhs)
_rewrite(hie, g_id, rule, {node: node})
elif isinstance(hie.node[g_id], RuleNode):
hie.node[g_id].rule.remove_node_attrs_rhs(node, attrs)
else:
raise ValueError("node is neither a rule nor a graph")
评论列表
文章目录