After his father's death, Hamlet becomes isolated from almost everyone who he once held dear, a fact that certainly adds to his status as a tragic figure.
First, he becomes alienated from his mother, Gertrude, because she very quickly remarries after Hamlet's father's death with her brother-in-law, Claudius. Hamlet sees this as an act of betrayal because his father so recently died (less than one month before her remarriage), and thus she did not appear to grieve appropriately. She seemed to be so in love with him while he was alive,
[...] yet, within a month
(Let me not think on 't; frailty, thy name is woman!
[....] Oh God, a beast that wants discourse of reason
Would have mourned longer!) [she] married with my uncle (1.2.149-156)
As a result of these feelings, Hamlet becomes estranged from his mother, believing her to be an improper wife. He likewise becomes estranged from his lover, Ophelia, when her father, Polonius, cautions her against attaching herself the young prince. He says,
Be something scanter of your maiden presence,
Set your entreatments at a higher rate
Than a command to parle.
[....] Do not believe his vows, for they are brokers,
Not of that dye which their investments show,
But mere implorators of unholy suits,
Breathing like sanctified and pious bawds
The better to beguile. (1.3.130-140)
Polonius tells her that she needs to keep herself apart from Hamlet and not simply appear whenever he beckons her. She should not believe his vows of love because they are only a mask for his sexual desire; his vows seem upright and honest but are just meant to deceive her into giving herself to him. Ophelia, a dutiful daughter, does as her father tells her, eventually returning any and all gifts Hamlet has given her, severing all private ties with him.
Hamlet is alienated from former friends as well when he learns that Rosencrantz and Guildenstern have been brought to Denmark by his uncle (who hopes that they will feed him information about Hamlet, now that he's grown suspicious of his nephew). Hamlet confronts them, saying,
You would play upon me, you would seem to know my stops, you would pluck out the heart of my mystery, you would sound me from my lowest note to the top of my compass [...]. 'Sblood, do you think I am easier to be played on than a pipe? Call me what instrument you will, though you can fret me, you cannot play upon me. (3.2.394-402)
The only really close relationship that Hamlet maintains throughout the tragedy is with Horatio. He's lost relationships with his father (who died), his mother (who betrayed his father in Hamlet's eyes), his uncle (who killed his father and married his mother), his friends (who he has killed in England), and his girlfriend (who goes mad when her ex-boyfriend, Hamlet, kills her father). Even before his death, the general public seemed to support Polonius' son, Laertes', bid for the throne (instead of Hamlet, to whom it should have gone upon his father's death). With no one left besides Horatio, it is him to whom Hamlet entrusts the telling of his story once he's dead.