The entire database contains several graphs, and the graph and graph may be linked by a node. How to find the connection node between graph A and graph B? Thank you for your advice!

# How to find the connection node between Graph A and Graph B

**neo4joe**(Neo4j) #2

You need to use a Between-ness Centrality Algorithm, which you can find in your Neo4j Desktop installations under Plugins. There you click Install under Algorithms. Here's some documentation on the Between-ness Algorithm there.

https://neo4j.com/docs/graph-algorithms/current/algorithms/betweenness-centrality/

**andrew.bowman**(Andrew Bowman) #3

We'll need more information to help.

How do you identify and differentiate the separate graphs? Are they all labeled according to the graph they belong to?

Do the connector nodes have a specific label that marks them as such? Or do they have both labels of the two graphs they belong to? Or is there any other way to identify them? Will there only be a single node that connects two graphs, or multiple nodes?

**ruanlovelin**(Ruanlovelin) #4

Thank you very much for your help! Let me give you a similar example: In a social network, there is a relationship of friends between each other, which forms a social circle. There are two social circles A and B. A and B are connected through a node x, and x can be regarded as a key node. My goal is to identify each subgraph in a large social network and to find all the key nodes.

**andrew.bowman**(Andrew Bowman) #5

That does sound like a perfect use for the betweenness centrality algorithm neo4joe mentioned above, check that one out.

**ruanlovelin**(Ruanlovelin) #6

I am using apoc to identify and differentiate the separate graphs.They are all labeled according to the graph they belong to.the connector nodes have not a specific label that marks them as such.they have not both labels of the two graphs they belong to.There may be multiple nodes connecting two graphics.Thank you very much!

**andrew.bowman**(Andrew Bowman) #7

That sounds like a good start. Do you know which graphs are adjacent? That is, do you already have the labels corresponding with the two graphs already, or do you only know the label of a single graph and you want to get all connecting nodes to all adjacent graphs?

Or is this meant to be a graph-wide query to find all nodes that connect two or more graphs?

Some example data (labels and relationship types and such) would help.

**ruanlovelin**(Ruanlovelin) #8

Your suggestion is very good, it is indeed a few places that I have not considered. Think about it carefully, I don't know which graphs are adjacent. Let me give you an example: In social networks, everyone's label is a person and the relationship type is is-friend. In this way, some circles and chains of friends in neo4j. I want to find any circle or chain of friends that I am interested in. I am more interested in finding all the key people who connect two or more chains. This is the two parts of a problem. Do you have any good suggestions?Thank you very much!

**ruanlovelin**(Ruanlovelin) #9

I am sorry.My english is pool.Thank you very much for your help!