MCPcopy Create free account
hub / github.com/Notgnoshi/generative / format_tgf

Function format_tgf

generative/dla.rs:258–281  ·  view source on GitHub ↗
(writer: &mut BufWriter<Box<dyn Write>>, graph: GraphType)

Source from the content-addressed store, hash-verified

256}
257
258pub fn format_tgf(writer: &mut BufWriter<Box<dyn Write>>, graph: GraphType) -> eyre::Result<()> {
259 // let (nodes, edges) = graph.into_nodes_edges();
260 for idx in graph.node_indices() {
261 let particle = graph
262 .node_weight(idx)
263 .ok_or_else(|| eyre::eyre!("Got index {idx:?} to nonexistent node"))?;
264 let label = idx.index();
265 writeln!(
266 writer,
267 "{label}\tPOINT({} {})",
268 particle.coordinates[0], particle.coordinates[1]
269 )?;
270 }
271 writeln!(writer, "#")?;
272 for edge in graph.edge_references() {
273 writeln!(
274 writer,
275 "{}\t {}",
276 edge.source().index(),
277 edge.target().index()
278 )?;
279 }
280 Ok(())
281}
282
283pub fn format_wkt(writer: &mut BufWriter<Box<dyn Write>>, graph: GraphType) -> eyre::Result<()> {
284 for idx in graph.node_indices() {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected