c++,algorithm,graph-theory,connected-components

Let's take a look at how many edges are created in the worst case. It is N * (MAX_R - MIN_L), which is 10^5 * 2000 under given constraints. You program runs out of memory and gets runtime error. A more efficient algorithm is required. Here is a simple solution...

python,image,image-processing,connected-components

If we can assume that the background is uniform and distinct from the sub-images, the following approach should work: Perform background subtraction by simply masking the background color (also, if the inner parts of the sub-images can contain the background color, flood-fill algorithm will work better here). Perform connected components...

python,sql,r,graph,connected-components

In R, you could use the package igraph: library(igraph) gg <- graph.edgelist(as.matrix(d), directed=F) split(V(gg)$name, clusters(gg)$membership) #$`1` #[1] "a" "b" "c" "u" "e" # #$`2` #[1] "f" "g" "h" "j" # #$`3` #[1] "z" "y" And you can look at the graph using: plot(gg) This is based on an excellent answer...

matlab,image-processing,watershed,connected-components

If you have the Image Processing Toolbox, I can also suggest the Circular Hough Transform through imfindcircles. However, this requires at least version R2012a, so if you don't have it, this won't work. For the sake of completeness, I'll assume you have it. This is a good method if you...

r,graph,igraph,connected-components

You can use the results from clusters to subset your nodes according to the cluster size. library(igraph) # example graph set.seed(1) g <- erdos.renyi.game(20, 1/20) V(g)$name <- letters[1:20] par(mar=rep(0,4)) plot(g) # get cluster cl <- clusters(g) cl # $membership # [1] 1 2 3 4 5 4 5 5 6...

algorithm,topological-sort,connected-components

Yes, it's technically correct, because a digraph without self-loops is acyclic (i.e., topologically sortable) iff all strong components have size 1. The most common topological sorts do cycle detection as an easy byproduct, though.

matlab,image-processing,bitmap,pixel,connected-components

An interesting problem, but not too difficult to solve. It will just require a lot of code, but each line of code is very simple in its understanding. This is the basic algorithm that I would perform: Find all circles in your image using the Circular Hough Transform - imfindcircles...

These are relative x- and y- coordinates. It becomes clearer if you convert this to coordinate pairs: x y neighbour ---------------------- -1 0 left 1 0 right 0 -1 bottom 0 1 top -1 1 left-top -1 -1 left-bottom 1 1 right-top 1 -1 right-bottom ...

matlab,image-processing,matlab-cvst,connected-components

The error output you are getting can be read from the bottom with a line of your code, and as you read the lines upwards it goes deeper into the call stack. So the top line gives the function that actually complained and the reason it gives. On this line...

matlab,image-processing,connected-components

I believe you are looking for bwboundaries - allowing you to trace the boundary of a binary mask in an image. Once you traced the boundary of your object you can divide it into "upper" and "lower".

matlab,image-processing,connected-components

Segmentation isn't my area, so I'm not sure what the best approach is. Here are a couple heuristic ideas I came up with: Discard regions that are too big or too small. It looks like you can expect a certain size from the vertebra. regionIdxs = unique(L(:)); regionSizes = accumarray(L(:)+1,1);...

python,postgresql,plpython,clique,connected-components

With networkX: import networkx as nx G1=nx.Graph() G1.add_edges_from([("a","b"),("b","c"),("c","d"),("d","e"),("f","g")]) sorted(nx.connected_components(G1), key = len, reverse=True) giving: [['a', 'd', 'e', 'b', 'c'], ['f', 'g']] You have to check the fastest algorithm now ... OP: This works great! I have this in my PostgreSQL database now. Just organize pairs into a two-column table, then...

matlab,image-processing,edge-detection,mathematical-morphology,connected-components

You are assuming CC is an array but it's actually a structure. Specifically, this is what the docs say about bwconncomp: bwconncomp Find connected components in binary image. CC = bwconncomp(BW) returns the connected components CC found in BW. BW is a binary image that can have any dimension. CC...