dhart.spatialstructures.Graph.clear_node_attribute¶
- Graph.clear_node_attribute(attribute: str)¶
Clear a node attribute and all of its scores from the graph
- Parameters:
attribute – The unique key of the attribute to delete from the graph
Example
Adding an attribute, then clearing it from the graph
>>> from dhart.spatialstructures import Graph >>> # Create a simple graph with 3 nodes >>> g = Graph() >>> g.AddEdgeToGraph(0, 1, 100) >>> g.AddEdgeToGraph(0, 2, 50) >>> g.AddEdgeToGraph(1, 2, 20) >>> csr = g.CompressToCSR()
>>> # Add node attributes to the simple graph >>> attr = "Test" >>> ids = [0, 1, 2] >>> scores = ["zero", "one", "two"] >>> g.add_node_attributes(attr, ids, scores)
>>> # Clear the attribute >>> g.clear_node_attribute(attr)
>>> # Get attribute scores from the graph >>> g.get_node_attributes(attr) []