1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::index::GraphIndex;
use crate::interface::StaticGraph;
use std::io::Write;
pub mod hamcircuit;
pub fn write_topology<Graph: StaticGraph, Writer: Write>(graph: &Graph, writer: &mut Writer) {
writeln!(writer, "{} {}", graph.node_count(), graph.edge_count()).unwrap();
for node in graph.node_indices() {
for out_neighbor in graph.out_neighbors(node) {
writeln!(
writer,
"{} {}",
node.as_usize(),
out_neighbor.node_id.as_usize()
)
.unwrap();
}
}
}