Gel formation through reversible and irreversible aggregation