Find similar users or employees

The question arises who is most similar to a certain account, for example if one wants to find out who belongs to a particular department. This question is especially important to easily check the correct configuration of the group memberships.

If everything is correct, then your own colleagues would have to exhibit most of the similarities!

The following script (which is also included in migRaven) is based on the assumption that people from a department would mostly have similarities -> same group memberships, thus one works via groups in the AD.

As long as the function is not integrated into migRaven, there is the possibility to use the web-interface of the migRaven database:


Currently the script must be executed directly via the console of the database. Important is the node (ID), which represents the outgoing account or group. One finds this ID in the migRaven interface in the Active Directory visualization:


Look for the interesting account and remember the value (ID of the node): 391951


Align as per the following script:

start u=node(391951) match p= u<-[:rel_member*]-gg-[:rel_member*0..]->(n{type:”person”}) where not (gg.name = “domänen-benutzer” or gg.name = “benutzer” or gg.name = “root”) and not (n.name = “Everyone” or n.name = “Authenticated Users”) and not id(n) = id(u) return n.name, id(n),count(nodes(p)) as gg order by gg DESC limit 50;

If u is a group:

start u=node(211) match p= u-[:rel_member]->x<-[:rel_member*]-gg-[:rel_member*]->(n{type:”person”}) where not (gg.name = “domänen-benutzer” or gg.name = “benutzer” or gg.name = “root”) and not id(n) = id(u) return n.name, id(n),count(nodes(p)) as gg order by gg DESC limit 50;

Then one gets an appropriate results list:

The value “gg” corresponds to the common group memberships with the appropriate account.

In plain language: Albert Herum has 92 common group memberships with Thomas Gomell.


If all group memberships are configured correctly, then the accounts from the same department with the most common features should appear. If there are other people from other departments, then this is clear indication that something is wrong.

Now, of course, it is still interesting to know from where the similarities originate. For this, use the following query:

start u=node(391703), n=node(391704) match p= u<-[:rel_member*]-gg-[:rel_member*0..]->(n) return distinct(gg.name) order by gg.name;

And you will get a list of all common groups: