SlideShare uma empresa Scribd logo
1 de 11
Least Common Ancestors in
      Constant Time
Motivation: GO Analysis on
     the Dendrogram
GO Analysis on Dendrogram

• For each GO term
   •   Pull out the skeleton sub-
     tree for this term
   •   Test for significance only
     at the nodes of this skeleton
     tree


• How does one pull out the
  skeleton sub-tree in time
  proportional to the size of
  that subtree?
LCA Queries

• Preprocess the tree in linear
  time, so..

• Given two nodes, the least
  common ancestor can be
  returned in O(1) time
LCA Queries on a Line Graph

• Rank nodes in order from top
  to bottom

• Take the min of the two
  ranks
Linearizing a Tree

• Label each node with its
  distance from the root

• Euler Tour to linearize nodes
  in an array (size 2n)




Find the node with the least label in
            this range
The Range Minimum Problem

• Given an array of size 2n,
  preprocess it in linear time
  so…



• Given a range, the min item in
  that range can be returned in
  O(1) time
Divide and Conquer

• Split into blocks at various
  levels of granularity

   – For each block, compute all
     prefix and suffix mins

   – Total space/preprocessing time
     O(nlog n)
Query Handling

• Given the query range

   – Determine the granularity level
     at which this range straddles
     adjacent blocks
       •   First bit diff in O(1) time


   – Look up the appropriate
     prefix/suffix mins in each block
       •   Look up precomputed tables in O(1)
           time
Reducing Preprocessing Time

•   Consider blocks of size Δ=log n/3

•   Two blocks are said to be equivalent
    if all within-block queries return the
    same min-index for the two blocks

•   How many equivalence classes are                 +1-1+1-1-1-1-1+1-1+1
    there:
     –   Recall Euler Tour, adjacent nos differ in
         +/-1, so 2Δ = n1/3

     –   For each distinct class and each of the
         possible log2n/9 queries precompute
         answers and store


     –   This takes time O(n1/3 log2n) = O(n)
Overall Preprocessing

•   Compute the O(n1/3 log2n) data
    structure for blocks of size
    =log n/3
     – Within block queries can be
       answered using this

•   Create a new array of size
    2n/(log n/3) = 6n/log n by
    replacing each block by just its
    minimum item

•   Preprocess this array as
    before, but now in O(n) time
    and space because the size of
    this array is just O(n/log n).

Mais conteúdo relacionado

Semelhante a Least common ancestors in constant time

K means and dbscan
K means and dbscanK means and dbscan
K means and dbscanYan Xu
 
Single Shot Multibox Detector
Single Shot Multibox DetectorSingle Shot Multibox Detector
Single Shot Multibox DetectorNamHyuk Ahn
 
ConstraintSatisfaction.ppt
ConstraintSatisfaction.pptConstraintSatisfaction.ppt
ConstraintSatisfaction.pptMdFazleRabbi53
 
Deep Learning Theory Seminar (Chap 1-2, part 1)
Deep Learning Theory Seminar (Chap 1-2, part 1)Deep Learning Theory Seminar (Chap 1-2, part 1)
Deep Learning Theory Seminar (Chap 1-2, part 1)Sangwoo Mo
 
Module 2 Design Analysis and Algorithms
Module 2 Design Analysis and AlgorithmsModule 2 Design Analysis and Algorithms
Module 2 Design Analysis and AlgorithmsCool Guy
 
ICPC 2015, Tsukuba : Unofficial Commentary
ICPC 2015, Tsukuba: Unofficial CommentaryICPC 2015, Tsukuba: Unofficial Commentary
ICPC 2015, Tsukuba : Unofficial Commentaryirrrrr
 
A Quantitative analysis and performance study for similarity search methods i...
A Quantitative analysis and performance study for similarity search methods i...A Quantitative analysis and performance study for similarity search methods i...
A Quantitative analysis and performance study for similarity search methods i...Jungyeol
 
clustering_hierarchical ckustering notes.pdf
clustering_hierarchical ckustering notes.pdfclustering_hierarchical ckustering notes.pdf
clustering_hierarchical ckustering notes.pdfp_manimozhi
 
shell and merge sort
shell and merge sortshell and merge sort
shell and merge sorti i
 
Lec03-CS110 Computational Engineering
Lec03-CS110 Computational EngineeringLec03-CS110 Computational Engineering
Lec03-CS110 Computational EngineeringSri Harsha Pamu
 
Zvi random-walks-slideshare
Zvi random-walks-slideshareZvi random-walks-slideshare
Zvi random-walks-slideshareZvi Lotker
 
Lecture 11.2 : sorting
Lecture 11.2 :  sortingLecture 11.2 :  sorting
Lecture 11.2 : sortingVivek Bhargav
 

Semelhante a Least common ancestors in constant time (20)

K means and dbscan
K means and dbscanK means and dbscan
K means and dbscan
 
Data Mining Lecture_8(b).pptx
Data Mining Lecture_8(b).pptxData Mining Lecture_8(b).pptx
Data Mining Lecture_8(b).pptx
 
sorting
sortingsorting
sorting
 
Single Shot Multibox Detector
Single Shot Multibox DetectorSingle Shot Multibox Detector
Single Shot Multibox Detector
 
sorting-160810203705.pptx
sorting-160810203705.pptxsorting-160810203705.pptx
sorting-160810203705.pptx
 
Quicksort
QuicksortQuicksort
Quicksort
 
ConstraintSatisfaction.ppt
ConstraintSatisfaction.pptConstraintSatisfaction.ppt
ConstraintSatisfaction.ppt
 
Deep Learning Theory Seminar (Chap 1-2, part 1)
Deep Learning Theory Seminar (Chap 1-2, part 1)Deep Learning Theory Seminar (Chap 1-2, part 1)
Deep Learning Theory Seminar (Chap 1-2, part 1)
 
densematrix.ppt
densematrix.pptdensematrix.ppt
densematrix.ppt
 
Ch07 linearspacealignment
Ch07 linearspacealignmentCh07 linearspacealignment
Ch07 linearspacealignment
 
Module 2 Design Analysis and Algorithms
Module 2 Design Analysis and AlgorithmsModule 2 Design Analysis and Algorithms
Module 2 Design Analysis and Algorithms
 
ICPC 2015, Tsukuba : Unofficial Commentary
ICPC 2015, Tsukuba: Unofficial CommentaryICPC 2015, Tsukuba: Unofficial Commentary
ICPC 2015, Tsukuba : Unofficial Commentary
 
A Quantitative analysis and performance study for similarity search methods i...
A Quantitative analysis and performance study for similarity search methods i...A Quantitative analysis and performance study for similarity search methods i...
A Quantitative analysis and performance study for similarity search methods i...
 
clustering_hierarchical ckustering notes.pdf
clustering_hierarchical ckustering notes.pdfclustering_hierarchical ckustering notes.pdf
clustering_hierarchical ckustering notes.pdf
 
PAM.ppt
PAM.pptPAM.ppt
PAM.ppt
 
shell and merge sort
shell and merge sortshell and merge sort
shell and merge sort
 
Lec03-CS110 Computational Engineering
Lec03-CS110 Computational EngineeringLec03-CS110 Computational Engineering
Lec03-CS110 Computational Engineering
 
binary tree
binary treebinary tree
binary tree
 
Zvi random-walks-slideshare
Zvi random-walks-slideshareZvi random-walks-slideshare
Zvi random-walks-slideshare
 
Lecture 11.2 : sorting
Lecture 11.2 :  sortingLecture 11.2 :  sorting
Lecture 11.2 : sorting
 

Mais de Strand Life Sciences Pvt Ltd (11)

Strand genomics features in CIO review
Strand genomics features in CIO reviewStrand genomics features in CIO review
Strand genomics features in CIO review
 
Rules of a Quantum World
Rules of  a Quantum WorldRules of  a Quantum World
Rules of a Quantum World
 
Introduction to statistics iii
Introduction to statistics iiiIntroduction to statistics iii
Introduction to statistics iii
 
Introduction to statistics ii
Introduction to statistics iiIntroduction to statistics ii
Introduction to statistics ii
 
Dynamic programming for simd
Dynamic programming for simdDynamic programming for simd
Dynamic programming for simd
 
Complex numbers polynomial multiplication
Complex numbers polynomial multiplicationComplex numbers polynomial multiplication
Complex numbers polynomial multiplication
 
Converting High Dimensional Problems to Low Dimensional Ones
Converting High Dimensional Problems to Low Dimensional OnesConverting High Dimensional Problems to Low Dimensional Ones
Converting High Dimensional Problems to Low Dimensional Ones
 
Searching using Quantum Rules
Searching using Quantum RulesSearching using Quantum Rules
Searching using Quantum Rules
 
Randomized algorithms
Randomized algorithmsRandomized algorithms
Randomized algorithms
 
Suffix arrays
Suffix arraysSuffix arrays
Suffix arrays
 
Alignment of raw reads in Avadis NGS
Alignment of raw reads in Avadis NGSAlignment of raw reads in Avadis NGS
Alignment of raw reads in Avadis NGS
 

Último

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Último (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

Least common ancestors in constant time

  • 1. Least Common Ancestors in Constant Time
  • 2. Motivation: GO Analysis on the Dendrogram
  • 3. GO Analysis on Dendrogram • For each GO term • Pull out the skeleton sub- tree for this term • Test for significance only at the nodes of this skeleton tree • How does one pull out the skeleton sub-tree in time proportional to the size of that subtree?
  • 4. LCA Queries • Preprocess the tree in linear time, so.. • Given two nodes, the least common ancestor can be returned in O(1) time
  • 5. LCA Queries on a Line Graph • Rank nodes in order from top to bottom • Take the min of the two ranks
  • 6. Linearizing a Tree • Label each node with its distance from the root • Euler Tour to linearize nodes in an array (size 2n) Find the node with the least label in this range
  • 7. The Range Minimum Problem • Given an array of size 2n, preprocess it in linear time so… • Given a range, the min item in that range can be returned in O(1) time
  • 8. Divide and Conquer • Split into blocks at various levels of granularity – For each block, compute all prefix and suffix mins – Total space/preprocessing time O(nlog n)
  • 9. Query Handling • Given the query range – Determine the granularity level at which this range straddles adjacent blocks • First bit diff in O(1) time – Look up the appropriate prefix/suffix mins in each block • Look up precomputed tables in O(1) time
  • 10. Reducing Preprocessing Time • Consider blocks of size Δ=log n/3 • Two blocks are said to be equivalent if all within-block queries return the same min-index for the two blocks • How many equivalence classes are +1-1+1-1-1-1-1+1-1+1 there: – Recall Euler Tour, adjacent nos differ in +/-1, so 2Δ = n1/3 – For each distinct class and each of the possible log2n/9 queries precompute answers and store – This takes time O(n1/3 log2n) = O(n)
  • 11. Overall Preprocessing • Compute the O(n1/3 log2n) data structure for blocks of size =log n/3 – Within block queries can be answered using this • Create a new array of size 2n/(log n/3) = 6n/log n by replacing each block by just its minimum item • Preprocess this array as before, but now in O(n) time and space because the size of this array is just O(n/log n).