Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4F865D8B7 for ; Sun, 14 Oct 2012 14:32:21 +0000 (UTC) Received: (qmail 46751 invoked by uid 500); 14 Oct 2012 14:32:21 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 46725 invoked by uid 500); 14 Oct 2012 14:32:21 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 46716 invoked by uid 99); 14 Oct 2012 14:32:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Oct 2012 14:32:20 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of david.myers.scibearspace@gmail.com designates 74.125.83.44 as permitted sender) Received: from [74.125.83.44] (HELO mail-ee0-f44.google.com) (74.125.83.44) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Oct 2012 14:32:15 +0000 Received: by mail-ee0-f44.google.com with SMTP id d4so2727947eek.31 for ; Sun, 14 Oct 2012 07:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=+O0AvAM/SchEGPFiOr1Vvhbo+Lci64Z3+de+B1vPzEI=; b=iyHWDR4QOl0zvk72EEdu+OjjyVMFKVyC+pWLoubuIs2oX/r+Eoa5B0TOoWoyNxQe29 B24/8toFb9lJEUy2Jcxy5snBtelJ8dj56ScD2U1m6FXtMKoxa05DHAO9KbAt+65JdWdQ mdVMOe19oO/a7UT1kfN5ZQrvV19hdUeEUPocwmo9K/MWv9WXghsmMRE2RBoLN/sW+v16 Sfq8nkoSedqpdmMsXir7dBzbwthO7zSvkAerKz+1Ed1u+oHsLPEgE8fue0mHGA/SO92u 8he9rG8BbgGGRQcF6g7HI/W4BGLiDI8lMhK6WQEuutpq/XdZENT8BIQA72ykXU7nU6uV EC7w== Received: by 10.14.220.134 with SMTP id o6mr12520980eep.35.1350225114584; Sun, 14 Oct 2012 07:31:54 -0700 (PDT) Received: from [192.168.1.10] (ALagny-153-1-20-170.w86-198.abo.wanadoo.fr. [86.198.11.170]) by mx.google.com with ESMTPS id 7sm20403732eeg.5.2012.10.14.07.31.52 (version=SSLv3 cipher=OTHER); Sun, 14 Oct 2012 07:31:53 -0700 (PDT) Message-ID: <507ACCD7.9010200@gmail.com> Date: Sun, 14 Oct 2012 16:31:51 +0200 From: david myers User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: Derby Discussion Subject: Re: Getting transitive closure? References: <507AA78C.7050003@gmail.com> In-Reply-To: <507AA78C.7050003@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi all, I learnt something today. COOL. So I had a quick look to understand what a weighted graph was see: http://www.informatics.susx.ac.uk/courses/dats/notes/html/node130.html Then I had a look at the http://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm link provided by John Moore. My line is in Gene / Protein analysis / bioinformatics, and both of these seem to have a sort of a relation to the BLAST (Basic Local Alignment Search Tool) algorithm (see http://www.ebi.ac.uk/2can/tutorials/protein/blast.html). I wonder if the result of a Warshall Algorithm can give more than one result with the same "score" If the use of the BLAST could be interesting to find the common paths, which could then be treated as "single" nodes, with the intention of rerunning the Warshall using these common nodes more often. I only add this in as I thought other may find it interesting, I certainly did. Thanks for an interesting thread. David On 14/10/12 13:52, John English wrote: > If I have a table defined like so: > > create table COMPONENTS ( > ID integer generated always as identity, > COMPONENT varchar(255) not null, > PARENT integer, > constraint COMPONENTS_PK primary key (ID), > constraint COMPONENTS_1 foreign key (PARENT) > references COMPONENTS(ID) > on delete cascade > ); > > with (for example): > > insert into COMPONENTS(COMPONENT,PARENT) values > ('IC package',null), -- ID = 1 > ('Flip-flop',1), -- ID = 2 > ('D-type',2), -- ID = 3 > ('JK flip-flop',2), -- ID = 4 > ('7474 dual D-type flip-flop',3), > ('4013 dual CMOS D-type flip-flop',3), > ('7476 dual JK flip-flop with preset and clear',4), > ('4027 dual CMOS JK flip-flop',4); > > Is there a clever an efficient way to get the set of all flip-flop > packages, i.e. ID=2, all items with parent=2, and so on down the chain > of descendants? Or in other words, the transitive closure of the set? > > TIA,