First of all, this poem is an elegy. Disillusioned with President Pierce, Whitman felt that he had found an ideal in Abraham Lincoln. When Lincoln was shot after the North's success in the Civil War, Whitman, like the "son" in the poem, feels abandoned by his "father," President Lincoln. Having rejoiced that "the fearful trip" of the war is over, Whitman moves the tone of his poem in three stanzas from the exultation of triumph to despair as the country is now without a leader. The speaker himself feels a personal loss: "But I with mournful tread,/Walk the deck my Captain lie,/Fallen cold and dead."
This poem's extended metaphor is that of a ship and its captain. "Captain" is the President, the "ship" is the "Ship of State," or America, "the swaying masses," are the citizenry. Initially, the crew of the ship express a tone of exultation, with longer phrases than in the latter part of the poem, as the victory is won, but the tone/mood changes as the crew member discovers the Captain is dead. He speaks in choked sentences of exclamation: "O heart! heart! heart!--the rhythm here is the rhythm of a fast-beating heart. Then, the tone changes to that of disbelief: "Rise up--for you the flag is flung, four you the bugle trilss..." Lovingly, the speaker addresses the captain as "father," implying the caring leadership of Lincoln. Finally, the mood changes despairingly inward: But I, with mournful tread,/Walk the deck my Captain lies,/Fallen cold and dead." That "Fallen cold and dead" is repeated several times before this last line indicates the shock and disbelief (inward conflict) of the speaker as well as his sense of personal loss. Left alone, he has to assume control of the helm now. The individual must assert himself and not just be part of the "swaying masses."
This lyrical poem is balanced with the religious number of three stanzas. With a conventional meter (iambic) and rhyme and parallelism, which is unlike Whitman, its appeal is also conventional as the poet intended.