How to list all nodes referencing a node in a tree view I have a content type Company with an entity reference field which can be referencing a content of the same type (Company), this field is also set to have multiple values.

What I want to achieve is to list all the companies referencing a company, as a recursive tree (may be only first 2-3 levels). 

For Example I have 5 Companies: CompanyA, CompanyB, CompanyC, CompanyD, CompanyE. Each of them referencing one or more companies. Let's say:

CompanyA:


CompanyC
CompanyE


CompanyB:


CompanyA
CompanyD


CompanyC:


CompanyA


CompanyD:


CompanyB
CompanyC
CompanyE


CompanyE:


CompanyB


If am viewing the CompanyA, I would like to have a list like:

Companies Referencing CompanyA:


CompanyB


CompanyD
CompanyE

CompanyC


CompanyA
CompanyD



I hope I was clear enough to explain my goal.
I have achieved this with Views and Views Field View.


I have added a View, showing Content of type Company and created a
Block with display format HTML List of fields.
Added a relationship Entity Reference: Referenced Entity Content entity referenced from field_reference_company
Added a contextual filter Content: Nid with the relationship
I've just added.
Provided a default value Content ID from URL to the contextual
filter.
Added the fields:

Content: Nid, excluded it from display.
Content: Title
Global: View and selected the view itself with Master Display, set as Contextual filters: [!nid]



That's it.