@@ -88,6 +88,12 @@ impl TreeSequence {
8888 unsafe { ( * ( self . as_ref ( ) ) . tables ) . nodes . num_rows }
8989 }
9090
91+ fn num_edges_raw ( & self ) -> bindings:: tsk_size_t {
92+ assert ! ( !self . as_ref( ) . tables. is_null( ) ) ;
93+ // SAFETY: none of the pointers are null
94+ unsafe { ( * ( self . as_ref ( ) ) . tables ) . edges . num_rows }
95+ }
96+
9197 pub fn kc_distance ( & self , other : & Self , lambda : f64 ) -> Result < f64 , TskitError > {
9298 let mut kc: f64 = f64:: NAN ;
9399 let kcp: * mut f64 = & mut kc;
@@ -103,4 +109,30 @@ impl TreeSequence {
103109 pub fn num_samples ( & self ) -> super :: newtypes:: SizeType {
104110 unsafe { bindings:: tsk_treeseq_get_num_samples ( self . as_ref ( ) ) } . into ( )
105111 }
112+
113+ pub fn edge_insertion_order ( & self ) -> & [ super :: newtypes:: EdgeId ] {
114+ assert ! ( !self . as_ref( ) . tables. is_null( ) ) ;
115+ // SAFETY: all array lengths are the number of rows in the table
116+ // SAFETY: no pointers can be null
117+ // SAFETY: tables are indexed in order to create a treeseq
118+ unsafe {
119+ super :: generate_slice (
120+ ( * self . as_ref ( ) . tables ) . indexes . edge_insertion_order ,
121+ self . num_edges_raw ( ) ,
122+ )
123+ }
124+ }
125+
126+ pub fn edge_removal_order ( & self ) -> & [ super :: newtypes:: EdgeId ] {
127+ assert ! ( !self . as_ref( ) . tables. is_null( ) ) ;
128+ // SAFETY: all array lengths are the number of rows in the table
129+ // SAFETY: no pointers can be null
130+ // SAFETY: tables are indexed in order to create a treeseq
131+ unsafe {
132+ super :: generate_slice (
133+ ( * self . as_ref ( ) . tables ) . indexes . edge_removal_order ,
134+ self . num_edges_raw ( ) ,
135+ )
136+ }
137+ }
106138}
0 commit comments