MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / get_graph_name

Method get_graph_name

ciphercore-base/src/graphs.rs:4147–4157  ·  view source on GitHub ↗

Returns the name of a graph. # Arguments `graph` - graph # Returns Name of a given graph # Example ``` # use ciphercore_base::graphs::create_context; let c = create_context().unwrap(); let g = c.create_graph().unwrap(); g.set_name("relu").unwrap(); assert_eq!(c.get_graph_name(g).unwrap(), "relu".to_owned()); ```

(&self, graph: Graph)

Source from the content-addressed store, hash-verified

4145 /// assert_eq!(c.get_graph_name(g).unwrap(), "relu".to_owned());
4146 /// ```
4147 pub fn get_graph_name(&self, graph: Graph) -> Result<String> {
4148 if graph.get_context() != *self {
4149 return Err(runtime_error!("The graph is in a different context"));
4150 }
4151 let cell = self.body.borrow();
4152 Ok(cell
4153 .graphs_names
4154 .get(&graph.get_id())
4155 .ok_or_else(|| runtime_error!("The graph does not have a name assigned"))?
4156 .clone())
4157 }
4158
4159 /// Returns the graph with a given name in this context.
4160 ///

Callers 1

get_nameMethod · 0.45

Calls 4

cloneMethod · 0.80
get_contextMethod · 0.45
getMethod · 0.45
get_idMethod · 0.45

Tested by

no test coverage detected