In order to test our algorithm, we first need to add a new property to the graph that will hold our prior belief about the node community membership – knownCommunity:
MATCH (A:Node {name: "A"}) SET A.knownCommunity = 0;
MATCH (B:Node {name: "B"}) SET B.knownCommunity = 0;
MATCH (F:Node {name: "F"}) SET F.knownCommunity = 1;
MATCH (G:Node {name: "G"}) SET G.knownCommunity = 1;
To some nodes, we have added a property called knownCommunity, which stores our prior knowledge (or belief) about the community each node belong to.
Then, we can create the named projected graph. This graph will contain all nodes with the Node label and all relationships with the LINKED_TO type. In order to use the algorithm in a semi-supervised way, we also need to explicitly tell the GDS to store the knownCommunity node property in the projected graph. Finally, we will consider our graph as undirected, which is achieved by specifying the orientation...