Given the data you reported (irregular menstrual cycles, vegetarian diet, not taking B12 vitamin), it is possible that you might have experienced changes in menstrual cycle length due to changes in hormone levels in the blood. The actual cause for the hormonal changes would have to be determined after an additional examination.
If there is no pathological cause detected, then it might be related to the diet. Vegetarians usually take food that might contain plant estrogens that mimic the real female sex hormones.
Although many women have experienced changes in menstrual cycle length while being on food rich in plant estrogens (soy, for example), there is no definitive conclusion on this issue in the scientific community. Otherwise, the length of the menstrual cycle is not shown to vary a lot in healthy women that take only vegetarian food and do not change their weight.
As for the B12 vitamin, you are advised to take supplements because it is only produced by certain types of bacteria and cannot be taken if you are on a vegetarian nutrition regimen. It is important for synthesis of folic acid, which is essential for proper development of the nervous system of the embryo.
You might want to visit a gynecologist for a physical examination and laboratory tests, which might reveal a hormonal imbalance and its cause. Blood tests might also reveal changes in B12 or folic acid levels in the blood. The treatment would depend on the underlying cause, but most likely B12 vitamin and folic acid supplements would be recommended.
Having intercourse regularly a couple of days before, on the day of ovulation, and after the ovulation might significantly increase the chances for getting pregnant.