Skip to content

Commit

Permalink
Merge master into feature/ReplaceAlgorithmResult
Browse files Browse the repository at this point in the history
  • Loading branch information
ljeub-pometry committed Jan 23, 2025
2 parents 337edcb + 82925e7 commit cb3f814
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions raphtory-graphql/src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,27 @@ impl Mut {
data.insert_graph(path, g).await?;
Ok(path.to_owned())
}

/// Create a subgraph out of some existing graph in the server
///
/// Returns::
/// name of the new graph
async fn create_subgraph<'a>(
ctx: &Context<'a>,
parent_path: &str,
nodes: Vec<String>,
new_path: String,
overwrite: bool,
) -> Result<String> {
let data = ctx.data_unchecked::<Data>();
let parent_graph = data.get_graph(parent_path)?.0.graph;
let new_subgraph = parent_graph.subgraph(nodes).materialize()?;
if overwrite {
let _ignored = data.delete_graph(&new_path);
}
data.insert_graph(&new_path, new_subgraph).await?;
Ok(new_path)
}
}

#[derive(App)]
Expand Down

0 comments on commit cb3f814

Please sign in to comment.