diff --git a/doc/examples/segmentation/plot_boundary_merge.py b/doc/examples/segmentation/plot_boundary_merge.py index d4f3c26d..e7cd89ce 100644 --- a/doc/examples/segmentation/plot_boundary_merge.py +++ b/doc/examples/segmentation/plot_boundary_merge.py @@ -13,7 +13,7 @@ from matplotlib import pyplot as plt def weight_boundary(graph, src, dst, n): """ - Callback to handle merging of nodes of a region boundary RAG. + Handle merging of nodes of a region boundary region adjacency graph. This function computes the `"weight"` and the count `"count"` attributes of the edge between `n` and the node formed after @@ -32,7 +32,7 @@ def weight_boundary(graph, src, dst, n): Returns ------- data : dict - A dictionary with the `"weight"` and `"count"` attributes to be + A dictionary with the "weight" and "count" attributes to be assigned for the merged node. """ @@ -47,7 +47,7 @@ def weight_boundary(graph, src, dst, n): count = count_src + count_dst return { 'count': count, - 'weight': (count_src*weight_src + count_dst*weight_dst)/count + 'weight': (count_src * weight_src + count_dst * weight_dst)/count } diff --git a/doc/examples/segmentation/plot_rag.py b/doc/examples/segmentation/plot_rag.py index 45d2afc5..ba6e2d3b 100644 --- a/doc/examples/segmentation/plot_rag.py +++ b/doc/examples/segmentation/plot_rag.py @@ -24,23 +24,23 @@ def max_edge(g, src, dst, n): """Callback to handle merging nodes by choosing maximum weight. Returns a dictionary with `"weight"` set as either the weight between - (`src`, `n`) or (`dst`, `n`) in `graph` or the maximum of the two when + (`src`, `n`) or (`dst`, `n`) in `g` or the maximum of the two when both exist. Parameters ---------- - graph : RAG + g : RAG The graph under consideration. src, dst : int - The verices in `graph` to be merged. + The vertices in `g` to be merged. n : int A neighbor of `src` or `dst` or both. Returns ------- data : dict - A dict with the `"weight"` attribute set the weight between - (`src`, `n`) or (`dst`, `n`) in `graph` or the maximum of the two when + A dict with the "weight" attribute set the weight between + (`src`, `n`) or (`dst`, `n`) in `g` or the maximum of the two when both exist. """