The epic is traditionally ascribed to the sage Vyasa, who is also a major character in the epic. Vyasa described it as being itihāsa (history). He also describes the Guru-shishya parampara, which traces all great teachers and their students of the Vedic times.
The first section of the Mahabharata states that it was Ganesha who wrote down the text to Vyasa's dictation. Ganesha is said to have agreed to write it only if Vyasa never paused in his recitation. Vyasa agrees on condition that Ganesha takes the time to understand what was said before writing it down.
The epic employs the story within a story structure, otherwise known as frametales, popular in many Indian religious and non-religious works. It is recited by the sage Vaisampayana, a disciple of Vyasa, to the King Janamejaya who is the great-grandson of the Pandava prince Arjuna. The story is then recited again by a professional storyteller named Ugrasrava Sauti, many years later, to an assemblage of sages performing the 12-year sacrifice for the king Saunaka Kulapati in the Naimisha Forest.
The text has been described by some early 20th-century western Indologists as unstructured and chaotic. Hermann Oldenberg supposed that the original poem must once have carried an immense "tragic force" but dismissed the full text as a "horrible chaos." Moritz Winternitz (Geschichte der indischen Literatur 1909) considered that "only unpoetical theologists and clumsy scribes" could have lumped the parts of disparate origin into an unordered whole.
Accretion and redaction
Research on the Mahabharata has put an enormous effort into recognizing and dating layers within the text. Some elements of the present Mahabharata can be traced back to Vedic times. The background to the Mahabharata suggests the origin of the epic occurs "after the very early Vedic period" and before "the first Indian 'empire' was to rise in the third century B.C." That this is "a date not too far removed from the 8th or 9th century B.C." is likely. It is generally agreed that "Unlike the Vedas, which have to be preserved letter-perfect, the epic was a popular work whose reciters would inevitably conform to changes in language and style," so the earliest 'surviving' components of this dynamic text are believed to be no older than the earliest 'external' references we have to the epic, which may include an allusion in Panini's 4th century BCE grammar Ashtādhyāyī 4:2:56. It is estimated that the Sanskrit text probably reached something of a "final form" by the early Gupta period (about the 4th century CE). Vishnu Sukthankar, editor of the first great critical edition of the Mahabharata, commented: "It is useless to think of reconstructing a fluid text in a literally original shape, on the basis of an archetype and a stemma codicum. What then is possible? Our objective can only be to reconstruct the oldest form of the text which it is possible to reach on the basis of the manuscript material available." That manuscript evidence is somewhat late, given its material composition and the climate of India, but it is very extensive.
The Mahabharata itself (1.1.61) distinguishes a core portion of 24,000 verses: the Bharata proper, as opposed to additional secondary material, while the Ashvalayana Grhyasutra (3.4.4) makes a similar distinction. At least three redactions of the text are commonly recognized: Jaya (Victory) with 8,800 verses attributed to Vyasa, Bharata with 24,000 verses as recited by Vaisampayana, and finally the Mahabharata as recited by Ugrasrava Sauti with over 100,000 verses. However, some scholars such as John Brockington, argue that Jaya and Bharata refer to the same text, and ascribe the theory of Jaya with 8,800 verses to a misreading of a verse in Adiparvan (1.1.81). The redaction of this large body of text was carried out after formal principles, emphasizing the numbers 18 and 12. The addition of the latest parts may be dated by the absence of the Anushasana-parva and the Virata parva from the "Spitzer manuscript". The oldest surviving Sanskrit text dates to the Kushan Period (200 CE).
According to what one character says at Mbh. 1.1.50, there were three versions of the epic, beginning with Manu (1.1.27), Astika (1.3, sub-parva 5) or Vasu (1.57), respectively. These versions would correspond to the addition of one and then another 'frame' settings of dialogues. The Vasu version would omit the frame settings and begin with the account of the birth of Vyasa. The astika version would add the sarpasattra and ashvamedha material from Brahmanical literature, introduce the name Mahabharata, and identify Vyasa as the work's author. The redactors of these additions were probably Pancharatrin scholars who according to Oberlies (1998) likely retained control over the text until its final redaction. Mention of the Huna in the Bhishma-parva however appears to imply that this parva may have been edited around the 4th century.
The Adi-parva includes the snake sacrifice (sarpasattra) of Janamejaya, explaining its motivation, detailing why all snakes in existence were intended to be destroyed, and why in spite of this, there are still snakes in existence. This sarpasattra material was often considered an independent tale added to a version of the Mahabharata by "thematic attraction" (Minkowski 1991), and considered to have a particularly close connection to Vedic (Brahmana) literature. The Panchavimsha Brahmana (at 25.15.3) enumerates the officiant priests of a sarpasattra among whom the names Dhrtarashtra and Janamejaya, two main characters of the Mahabharata's sarpasattra, as well as Takshaka, the name of a snake in the Mahabharata, occur.
The earliest known references to the Mahabharata and its core Bharata date to the Ashtadhyayi (sutra 6.2.38) of Pāṇini (fl. 4th century BCE) and in the Ashvalayana Grhyasutra (3.4.4). This may suggest that the core 24,000 verses, known as the Bharata, as well as an early version of the extended Mahabharata, were composed by the 4th century BCE.
A report by the Greek writer Dio Chrysostom (c. 40 - c. 120 CE) about Homer's poetry being sung even in India seems to imply that the Iliad had been translated into Sanskrit. However, scholars have, in general, taken this as evidence for the existence of a Mahabharata at this date, whose episodes Dio or his sources identify with the story of the Iliad.
Several stories within the Mahabharata took on separate identities of their own in Classical Sanskrit literature. For instance, Abhijñānashākuntala by the renowned Sanskrit poet Kālidāsa (c. 400 CE), believed to have lived in the era of the Gupta dynasty, is based on a story that is the precursor to the Mahabharata. Urubhanga, a Sanskrit play written by Bhāsa who is believed to have lived before Kālidāsa, is based on the slaying of Duryodhana by the splitting of his thighs by Bhima.
The copper-plate inscription of the Maharaja Sharvanatha (533–534 CE) from Khoh (Satna District, Madhya Pradesh) describes the Mahabharata as a "collection of 100,000 verses" (shatasahasri samhita).
The 18 parvas or books
The division into 18 parvas is as follows:
|1||Adi Parva (The Book of the Beginning)||1–19||How the Mahabharata came to be narrated by Sauti to the assembled rishis at Naimisharanya, after having been recited at the sarpasattra of Janamejaya by Vaishampayana at Takṣaśilā. The history and genealogy of the Bharata and Bhrigu races is recalled, as is the birth and early life of the Kuru princes (adi means first).|
|2||Sabha Parva (The Book of the Assembly Hall)||20–28||Maya Danava erects the palace and court (sabha), at Indraprastha. Life at the court, Yudhishthira's Rajasuya Yajna, the game of dice, the disrobing of Pandava wife Draupadi and eventual exile of the Pandavas.|
|3||Vana Parva also Aranyaka-parva, Aranya-parva (The Book of the Forest)||29–44||The twelve years of exile in the forest (aranya).|
|4||Virata Parva (The Book of Virata)||45–48||The year spent incognito at the court of Virata.|
|5||Udyoga Parva (The Book of the Effort)||49–59||Preparations for war and efforts to bring about peace between the Kaurava and the Pandava sides which eventually fail (udyoga means effort or work).|
|6||Bhishma Parva (The Book of Bhishma)||60–64||The first part of the great battle, with Bhishma as commander for the Kaurava and his fall on the bed of arrows. (Includes the Bhagavad Gita in chapters 25-42.)|
|7||Drona Parva (The Book of Drona)||65–72||The battle continues, with Drona as commander. This is the major book of the war. Most of the great warriors on both sides are dead by the end of this book.|
|8||Karna Parva (The Book of Karna)||73||The continuation of the battle with Karna as commander of the Kaurava forces.|
|9||Shalya Parva (The Book of Shalya)||74–77||The last day of the battle, with Shalya as commander. Also told in detail, is the pilgrimage of Balarama to the fords of the river Saraswati and the mace fight between Bhima and Duryodhana which ends the war, since Bhima kills Duryodhana by smashing him on the thighs with a mace.|
|10||Sauptika Parva (The Book of the Sleeping Warriors)||78–80||Ashvattama, Kripa and Kritavarma kill the remaining Pandava army in their sleep. Only 7 warriors remain on the Pandava side and 3 on the Kaurava side.|
|11||Stri Parva (The Book of the Women)||81–85||Gandhari and the women (stri) of the Kauravas and Pandavas lament the dead and Gandhari cursing Krishna for the massive destruction and the extermination of the Kaurava.|
|12||Shanti Parva (The Book of Peace)||86–88||The crowning of Yudhisthira as king of Hastinapura, and instructions from Bhishma for the newly anointed king on society, economics and politics. This is the longest book of the Mahabharata. Kisari Mohan Ganguli considers this Parva as a later interpolation.'|
|13||Anushasana Parva (The Book of the Instructions)||89–90||The final instructions (anushasana) from Bhishma.|
|14||Ashvamedhika Parva (The Book of the Horse Sacrifice)||91–92||The royal ceremony of the Ashvamedha (Horse sacrifice) conducted by Yudhisthira. The world conquest by Arjuna. The Anugita is told by Krishna to Arjuna.|
|15||Ashramavasika Parva (The Book of the Hermitage)||93–95||The eventual deaths of Dhritarashtra, Gandhari and Kunti in a forest fire when they are living in a hermitage in the Himalayas. Vidura predeceases them and Sanjaya on Dhritarashtra's bidding goes to live in the higher Himalayas.|
|16||Mausala Parva (The Book of the Clubs)||96||The materialisation of Gandhari's curse, i.e., the infighting between the Yadavas with maces (mausala) and the eventual destruction of the Yadavas.|
|17||Mahaprasthanika Parva (The Book of the Great Journey)||97||The great journey of Yudhisthira, his brothers and his wife Draupadi across the whole country and finally their ascent of the great Himalayas where each Pandava falls except for Yudhisthira.|
|18||Svargarohana Parva (The Book of the Ascent to Heaven)||98||Yudhisthira's final test and the return of the Pandavas to the spiritual world (svarga).|
|khila||Harivamsa Parva (The Book of the Genealogy of Hari)||99–100||This is an addendum to the 18 books, and covers those parts of the life of Krishna which is not covered in the 18 parvas of the Mahabharata.|