If I have some nodes coordinates and I have to group these nodes together if there is path exist between them. Is there any algorithm available?
The graph structure looks like below:
# Load the packages using LightGraphs, GraphPlot, MetaGraphs, GraphRecipes, Plots # Create a generic graph gr = SimpleGraph() add_vertices!(gr, size(mat_arcTwoNodes, 1)) # Add edges based on the adjacency matrix for i in 1:size(mat_arcTwoNodes, 1), j in 1:size(mat_arcTwoNodes, 2) if mat_arcTwoNodes[i,j] != 0 add_edge!(gr, i, j) else nothing end end # Attach the metagraph to the original graph mgr = MetaGraph(gr) # Add the attribute of nodes for i in 1:size(mat_arcTwoNodes,1) set_props!(mgr, i, Dict( Symbol("vec_xNode") => vec_xNode[i], Symbol("vec_yNode") => vec_yNode[i] )) end nodelabel = 1:nv(g) # Plot the graph graphplot(gr, x=vec_xNode, y=vec_yNode, names = 1:10, markersize = 2.0)
If I have co-ordinates of nodes 4,5,6,7 and 3 in the graph generated using above code. I have to group 4,5, and 6 together and 3 and 7 as another group. Is there any algorithm available for this kind of grouping?
Thanks in advance,