[Oberon] tree programming

John R. Strohm strohm at airmail.net
Wed Sep 5 17:55:14 CEST 2018


You are talking about "4-way connectivity blob coloring".

There exists a very well-known recursive algorithm.

There does exist an iterative algorithm, but you also have to maintain a separate equivalence map, to handle the cases where two separate blobs come in contact and are learned to be in fact one larger blob.

--- d.gloetzel at web.de wrote:

From: Dieter <d.gloetzel at web.de>
To: <oberon at lists.inf.ethz.ch>
Subject: [Oberon] tree programming
Date: Wed, 5 Sep 2018 15:57:16 +0200

Imagin a matrix consisting of "0"  and "1". Now I want to separate the 
islands of "1" and get a handle on
the indices of each island.
i.e. : I want to transform this:
  0 0 0 0 0 1 0 1 1 0 1 0 0
  0 0 0 0 0 1 0 1 0 0 1 0 1
  0 0 0 0 0 1 0 1 0 1 0 0 1
  0 0 0 0 1 1 0 0 0 1 0 1 0
  0 0 0 1 1 0 0 0 0 0 0 1 0
  0 0 0 1 1 1 1 0 0 0 0 0 0
into something like this:
  0 0 0 0 0 1 0 2 2 0 3 0 0
  0 0 0 0 0 1 0 2 0 0 3 0 6
  0 0 0 0 0 1 0 2 0 4 0 0 6
  0 0 0 0 1 1 0 0 0 4 0 5 0
  0 0 0 1 1 0 0 0 0 0 0 5 0
  0 0 0 1 1 1 1 0 0 0 0 0 0


I only half-understand, what Wirth writes on trees in his green Oberonbook.
But it looks to me like a tree problem.

Thanks and regards,
Dieter




-- 
____________________________________
Dr. Dieter Glötzel
Im Rosengarten 27
64367 Mühltal

--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon




More information about the Oberon mailing list