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

Method graph

generative/triangulation.rs:130–150  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

128 }
129
130 pub fn graph(&self) -> GeometryGraph<Undirected> {
131 let digraph = self.digraph();
132 let nodes = self.points.len();
133 let directed_edges = self.triangulation.halfedges.len();
134 let mut graph =
135 GeometryGraph::with_capacity(nodes, directed_edges - self.triangulation.hull.len());
136
137 // Add the nodes
138 for (_i, node) in digraph.raw_nodes().iter().enumerate() {
139 let _node_index = graph.add_node(node.weight);
140 debug_assert_eq!(_i, _node_index.index());
141 }
142
143 // Add the edges. Use update_edge() to avoid duplicates
144 for edge in digraph.raw_edges() {
145 #[allow(clippy::unit_arg)]
146 let _edge_index = graph.update_edge(edge.source(), edge.target(), edge.weight);
147 }
148
149 graph
150 }
151
152 #[allow(non_snake_case)]
153 fn longest_edge(&self, a: usize, b: usize, c: usize) -> (usize, usize) {

Callers 4

mainFunction · 0.80
urquhartMethod · 0.80
test_graphFunction · 0.80
test_urquhartFunction · 0.80

Calls 2

digraphMethod · 0.80
add_nodeMethod · 0.80

Tested by 2

test_graphFunction · 0.64
test_urquhartFunction · 0.64