MCPcopy Create free account
hub / github.com/Pometry/Raphtory / add_node

Method add_node

raphtory/src/python/graph/graph.rs:290–315  ·  view source on GitHub ↗
(
        &self,
        timestamp: EventTimeComponent,
        id: GID,
        properties: Option<Bound<PyDict>>,
        node_type: Option<&str>,
        event_id: Option<usize>,
        layer: Opt

Source from the content-addressed store, hash-verified

288 signature = (timestamp, id, properties = None, node_type = None, event_id = None, layer = None)
289 )]
290 pub fn add_node(
291 &self,
292 timestamp: EventTimeComponent,
293 id: GID,
294 properties: Option<Bound<PyDict>>,
295 node_type: Option<&str>,
296 event_id: Option<usize>,
297 layer: Option<&str>,
298 ) -> Result<NodeView<'static, Graph>, GraphError> {
299 let props = properties
300 .into_iter()
301 .flat_map(|map| {
302 map.into_iter().map(|(k, v)| {
303 k.extract::<String>()
304 .and_then(|k| v.extract::<Prop>().map(move |v| (k, v)))
305 })
306 })
307 .collect::<Result<Vec<_>, _>>()?;
308 match event_id {
309 None => self.graph.add_node(timestamp, id, props, node_type, layer),
310 Some(event_id) => {
311 self.graph
312 .add_node((timestamp, event_id), id, props, node_type, layer)
313 }
314 }
315 }
316
317 /// Creates a new node with the given id and properties to the graph. It fails if the node already exists.
318 ///

Callers 15

init_graphFunction · 0.45
init_graph2Function · 0.45
init_graph4Function · 0.45
init_nodes_graphFunction · 0.45
init_nodes_graph1Function · 0.45
init_nodes_graph2Function · 0.45
create_test_graphFunction · 0.45
create_test_graph3Function · 0.45
test_metadata_propsFunction · 0.45
create_graphFunction · 0.45

Calls 2

into_iterMethod · 0.45
mapMethod · 0.45

Tested by 15

test_metadata_propsFunction · 0.36
create_graphFunction · 0.36
test_raphtory_clientFunction · 0.36
test_upload_graphFunction · 0.36
setup_graphFunction · 0.36
create_graphFunction · 0.36
test_default_templateFunction · 0.36
init_graphFunction · 0.36
init_graphFunction · 0.36