33 int nHyperNodesNum = 0;
35 assert( Abc_NtkIsStrash( pNtk ) && Abc_NtkIsComb( pNtk ) );
37 FILE *pFHMetis = fopen( pFileName,
"wb" );
38 Vec_Ptr_t *vHyperEdges = Vec_PtrAlloc( 1000 );
39 if ( pFHMetis == NULL )
41 fprintf( stdout,
"Io_WriteHMetis(): Cannot open the output file \"%s\".\n", pFileName );
49 Abc_Print( 1,
"Writing hMetis file \"%s\" with %d nodes (%d pi, %d po, %d and nodes).\n", pFileName, Abc_NtkObjNum( pNtk ), Abc_NtkPiNum( pNtk ), Abc_NtkPoNum( pNtk ), Abc_NtkNodeNum( pNtk ) );
54 Vec_Int_t *vHyperEdgeEach = Vec_IntAlloc( 20 );
56 Vec_IntPush( vHyperEdgeEach, Abc_ObjId( pObj ) );
58 if ( !Abc_ObjIsCo( pObj ) )
62 Vec_IntPush( vHyperEdgeEach, Abc_ObjId( pFanout ) );
70 Vec_IntPush( vHyperEdgeEach, Abc_ObjId( Abc_ObjFanin0( pObj ) ) );
72 Vec_PtrPush( vHyperEdges, vHyperEdgeEach );
75 nHyperNodesNum = Abc_NtkObjNum( pNtk );
80 fprintf( pFHMetis,
"%d %d 1\n", Vec_PtrSize( vHyperEdges ), nHyperNodesNum );
83 fprintf( pFHMetis,
"%d %d\n", Vec_PtrSize( vHyperEdges ), nHyperNodesNum );
90 fprintf( pFHMetis,
"%d ", Vec_IntSize( vHyperEdgeEachWrite ) );
95 if ( j == Vec_IntSize( vHyperEdgeEachWrite ) - 1 )
97 fprintf( pFHMetis,
"%d", iEntry );
100 fprintf( pFHMetis,
"%d ", iEntry );
103 fprintf( pFHMetis,
"\n" );
106 fprintf( pFHMetis,
"%%This file was written by ABC on %s\n",
Extra_TimeStamp() );
107 fprintf( pFHMetis,
"%%For information about hMetis format, refer to %s\n",
"https://karypis.github.io/glaros/files/sw/hmetis/manual.pdf" );
108 Vec_PtrFreeFree( vHyperEdges );