If I have a set of nodes like graph and [A, B, J, K] like grid.
In the above example, [A, B] are imminent and [J, K] are imminent, but completely, a cluster does not cluster if 'F' is passed [A, B, F , J, K] have been added to the set, so I consider it to be a cluster. Updated: I already have a function that checks if two nodes are adjacent boolean handgate (node a, node b). To check the cluster just need to expand it. Your original article is create a graph If the graph Can be done with something to find more connected components. ( Note , using flood flooding in the first place with restriction, it actually build graph of Eg has the edges. Roots & lt; - New map & lt; Node, interger & gt; For every node for each root // // for each node, // run a BFS for each root, // and calculate the total number of accessible elements from that line; & Lt; - {n} roots.put (n, 1) while (queue is not empty): Curr & lt; - queue.takeFirst () for each side (curr, u) in E: if (u is in SET): SET.delete (u) queue.add (u) roots.put (roots.get (n) + 1 ) Maximum Returns {roots.get (v) | However, the above pseudo code does not generate the code G = (V, E) and
SET set of desired node (
SET <= code> )
g = '(V', 'E') Where
V '= SET and
E' = {(U, V). (U, V) is in E and U, V is in SET}
g is connected then you have a group of all the elements < Br> The maximum number of clusters in the cluster is
g .
G ' without the need to create it
int maximalcluster (E, SET): // SET is the set of the desired nodes,
G , it only identifies the edges by checking the edges which are in their nodes.
Comments
Post a Comment