@@ -92,23 +92,15 @@ int LAGr_PartitionQuality(
9292 "G->nself_edges is required" ) ;
9393
9494 GrB_Matrix A = G -> A ;
95- GRB_TRY (GrB_Matrix_nrows (& n , A ));
9695
97- if (G -> nself_edges > 0 )
98- {
99- // Delete self-edges, not relevant to these clustering metrics
100- // BOOL type is fine because _A is only used against the pair biop
101- GRB_TRY (GrB_Matrix_new (& _A , GrB_BOOL , n , n ));
102- GRB_TRY (GrB_select (_A , NULL , NULL , GrB_OFFDIAG , A , 0 , NULL ));
103- A = _A ;
104- }
10596
10697#if 0
10798 FILE * f = fopen ("./data/pp_sanitized_data.mtx" , "w" );
10899 LAGRAPH_TRY (LAGraph_MMWrite (A , f , NULL , msg ));
109100 fclose (f );
110101#endif
111102
103+ GRB_TRY (GrB_Matrix_nrows (& n , A ));
112104 GRB_TRY (GrB_Matrix_nvals (& nedges , A ));
113105
114106 GRB_TRY (GrB_Matrix_new (& C , GrB_INT64 , n , n ));
@@ -150,6 +142,12 @@ int LAGr_PartitionQuality(
150142 GRB_TRY (
151143 GrB_reduce (& n_intraEdges , NULL , GrB_PLUS_MONOID_INT64 , trace , NULL ));
152144
145+ if (G -> nself_edges > 0 )
146+ {
147+ n_intraEdges -= G -> nself_edges ;
148+ nedges -= G -> nself_edges ;
149+ }
150+
153151 if (perf )
154152 {
155153 // undirected case
0 commit comments