E-mail List Archives

Re: is this table linearizable?


From: Jukka K. Korpela
Date: Nov 28, 2006 5:40AM

On Tue, 28 Nov 2006, Patrick H. Lauke wrote:

> Quoting Shrirang Sahasrabudhe < <EMAIL REMOVED> >:
>> Can anyone tell me whether the following table is linearizable or not?
>> I feel it is not, correct me if wrong.
> Just to clarify: in general terms, the concept of linearisation only
> applies to *layout* tables. Data tables, as in your example, are a
> different matter altogether...it's not the linearisation that needs to
> be looked at there, but the actual structure.

The concept of linearization can be defined in a manner that makes sense
for all tables: is the table understandable and useable if it is rendered
in a linearized manner, rowwise, much like the <table> were not present at
all (or, let us say more fairly, as if the rendering presented just the
contents of cells sequentially, with some markers between cells and
different markers between rows)?

Such a definition is relevant and useful, and linearizability of all
tables is a good goal, though not at any cost. In this case, the original
table is not linearized, since we get a sequence of countries and a
sequence of capitals. The user would have to count the items to keep track
so that he can know which of the names in the list of capitals is the
capital of Syldavia, which he was looking for.

Besides, there is a simple cure that makes the table linearizable:
transpose the matrix, i.e. make each row contain one country and her
capital. Sometimes this wastes space too much, but normally not. And it is
a more flexible and more extendible approach. You can present _all_
countries that way - something that you definitely don't want to do when
using a two-row approach with all countries on one row.

> Just from that, I'd say it should really be redefined as
> <table>
> <thead>
> <tr><th>country0</th><th>country1</th><th>country2</th></tr>
> </thead>
> <tbody>
> <tr><td>capital0</td><td>capital1</td><td>capital2</td></tr>
> </tbody>
> </table>

According to HTML specifications, the <th> markup should be used when a
cell _only_ contains header information, which I interpret as
metainformation _about_ data in the table, as opposite to actual data _in_
the table. For example, in a table of countries and capitals, cells with
words like "Country" and "Capital" should be marked up as <th>. In this
case, the cells contain actual data, even though it can also be seen as
being in a header/data relationship to the capital. Thus, <td scope="col">
would be more logical than <th>.

I would transpose the matrix:

<tr> <th scope="col">Country</th> <th scope="col">Capital</th> </tr>
<tr> <td scope="row>country0</td> <td>capital0</td> </tr>

In practice, I would probably be so lazy that I would omit the scope
attributes, since I fail to see their practical usefulness here.

Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/