MCPcopy Create free account
hub / github.com/alibaba/GraphScope / set_edge_data

Method set_edge_data

python/graphscope/nx/classes/graph.py:1042–1075  ·  view source on GitHub ↗

Set edge data of edge (u, v). Parameters ---------- u, v : nodes Nodes can be int, str, float, tuple, bool hashable Python objects. data: dict Edge data to set to edge (u, v) See Also -------- set_node_data : set node

(self, u, v, data)

Source from the content-addressed store, hash-verified

1040
1041 @clear_mutation_cache
1042 def set_edge_data(self, u, v, data):
1043 """Set edge data of edge (u, v).
1044
1045 Parameters
1046 ----------
1047 u, v : nodes
1048 Nodes can be int, str, float, tuple, bool hashable Python objects.
1049 data: dict
1050 Edge data to set to edge (u, v)
1051
1052 See Also
1053 --------
1054 set_node_data : set node data of node
1055
1056 Notes
1057 -----
1058 the method is called when to set_items in AdjEdgeAttr
1059
1060 Examples
1061 --------
1062 >>> G = nx.Graph() # or DiGraph
1063 >>> G.add_edge(1, 2)
1064 >>> dd = {'foo': 'bar'}
1065 >>> G[1][2] = dd # call G.set_edge_data(1, 2, dd)
1066 >>> G[1][2]
1067 {'foo': 'bar'}
1068
1069 """
1070 self._convert_arrow_to_dynamic()
1071
1072 edge = json.dumps(((u, v, data),), option=json.OPT_SERIALIZE_NUMPY)
1073 self._op = dag_utils.modify_edges(self, types_pb2.NX_UPDATE_EDGES, edge)
1074 self._op.eval(leaf=False)
1075 self.cache.clear_neighbor_attr_cache()
1076
1077 @clear_mutation_cache
1078 def set_node_data(self, n, data):

Callers 7

__setitem__Method · 0.45
__delitem__Method · 0.45
clearMethod · 0.45
updateMethod · 0.45
popMethod · 0.45
popitemMethod · 0.45
set_edge_attributesFunction · 0.45

Calls 3

evalMethod · 0.45

Tested by

no test coverage detected