From bd533756590e05cad491077f72a5ff7c4b23b460 Mon Sep 17 00:00:00 2001 From: JingrenWang Date: Sun, 13 Jul 2025 15:59:43 +0800 Subject: [PATCH] Fix(hMetis): Move const to largest index + 1 Signed-off-by: JingrenWang --- src/base/io/ioWriteHMetis.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/base/io/ioWriteHMetis.c b/src/base/io/ioWriteHMetis.c index 90527a0dcb..49d31a76b7 100644 --- a/src/base/io/ioWriteHMetis.c +++ b/src/base/io/ioWriteHMetis.c @@ -53,7 +53,15 @@ void Io_WriteHMetis( Abc_Ntk_t *pNtk, char *pFileName, int fSkipPo, int fWeightE { Vec_Int_t *vHyperEdgeEach = Vec_IntAlloc( 20 ); // push the node itself, which is a source node - Vec_IntPush( vHyperEdgeEach, Abc_ObjId( pObj ) ); + // make const node has the id of the maxNodeNum, this is due to the design of 1-index based kahypar + if(Abc_AigNodeIsConst( pObj )) + { + Vec_IntPush( vHyperEdgeEach, Abc_NtkObjNum( pNtk ) ); + } + else + { + Vec_IntPush( vHyperEdgeEach, Abc_ObjId( pObj ) ); + } // iterate through all the fanouts(sink) of the node if ( !Abc_ObjIsCo( pObj ) ) { @@ -61,7 +69,8 @@ void Io_WriteHMetis( Abc_Ntk_t *pNtk, char *pFileName, int fSkipPo, int fWeightE { Vec_IntPush( vHyperEdgeEach, Abc_ObjId( pFanout ) ); } - } else + } + else { if ( fSkipPo ) {