SlideShare a Scribd company logo
1 of 12
Download to read offline
BisPy
un pacchetto Python per il calcolo
della massima bisimulazione di grafi diretti
Francesco Andreuzzi
Università degli Studi di Trieste,
Dipartimento di Ingegneria e Architettura
8 Luglio 2021
Anno accademico 2020-2021 Relatore: Prof. Alberto Casagrande
Francesco Andreuzzi BisPy 8 Luglio 2021 1 / 12
Grafi orientati, terminologia
V = {a, b, c, d, e}
E = {ha, bi, hb, ci, ha, di, hc, ei, hd, ei}
a
b
c
d
e
Definizione
Se ha, bi ∈ E =⇒ b è un nodo figlio di a.
Un nodo privo di figli è detto pozzo.
Francesco Andreuzzi BisPy 8 Luglio 2021 2 / 12
Bisimulazione
Definizione: Bisimulazione B ⊆ V × V
Se (a, b) ∈ B, allora da a è possibile spostarsi verso un nodo figlio di a che
sia in relazione con un nodo figlio di b, e viceversa.
a
c
b
d e f g
B = {(b, c), (e, g), (d, f )}
Definizione: Nodi bisimili
I nodi a, b sono bisimili se esiste una bisimulazione B tale che (a, b) ∈ B.
Francesco Andreuzzi BisPy 8 Luglio 2021 3 / 12
Massima bisimulazione
Definizione
La massima bisimulazione su G = (V , E) è la bisimulazione BM tale che:
R ⊆ BM per ogni bisimulazione R su G.
Si può dimostrare che:
1 La massima bisimulazione è unica;
2 La massima bisimulazione è una relazione di equivalenza
=⇒ induce un partizionamento su V ;
3 BM(a, b) ≡
[
R è una
bisimulazione
R;
4 BM definita come nel punto 3. è una bisimulazione.
Francesco Andreuzzi BisPy 8 Luglio 2021 4 / 12
Massima bisimulazione -- Esempio e applicazioni pratiche
a
c
b
d e f g
BM =

(a, a) , (b, c), (c, b) ,
(b, b), (c, c) , (d, d) ,
(e, e), (f , f ), (g, g) ,
(d, e), (e, d), (d, f ) ,
(f , d), (d, g), (g, d) ,
(e, f ), (f , e), (e, g) ,
(g, e), (f , g), (g, f )
	
A
B
C
Ricerca di nodi equivalenti;
Minimizzazione;
Concurrency theory;
XML indexing.
Francesco Andreuzzi BisPy 8 Luglio 2021 5 / 12
Algoritmi per il calcolo della massima bisimulazione
Non incrementali, complessità asintotica |E| log |V |
Algoritmo di Paige-Tarjan;
Algoritmo di Dovier-Piazza-Policriti;
BM(u, v) =⇒ rank(u) = rank(v).
Incrementali
Algoritmo incrementale di Saha.
Francesco Andreuzzi BisPy 8 Luglio 2021 6 / 12
BisPy
Python 3;
Open source (https://github.com/fAndreuzzi/BisPy);
Testato su diverse tipologie di grafo, di dimensioni varie.
Example
from bispy import paige_tarjan
# creazione del grafo
graph = networkx.balanced_tree(2,3)
# calcolo della massima bisimulazione
paige_tarjan(graph)
 [(7, 8, 9, 10, 11, 12, 13, 14), (3, 4, 5, 6),
(1, 2), (0,)]
Francesco Andreuzzi BisPy 8 Luglio 2021 7 / 12
Risultati sperimentali I -- Paige-Tarjan, Dovier-Piazza-Policriti
102 104 106
10−4
100
104
Numero di nodi
Secondi
Alberi bilanciati
PT
DPP
a
c
b
d e f g
Un albero bilanciato.
Francesco Andreuzzi BisPy 8 Luglio 2021 8 / 12
Risultati sperimentali II -- Paige-Tarjan, Saha
0 500 1,000 1,500 2,000
10−3
10−2
Numero di nodi
Tempo
medio
(secondi)
Aggiornamento della massima bisimulazione dopo l’aggiunta di un arco
Paige-Tarjan
Saha
0.2
0.4
Secondi
Paige-Tarjan
Saha
Francesco Andreuzzi BisPy 8 Luglio 2021 9 / 12
Conclusione
Il software sviluppato consente di osservare e confrontare il
comportamento degli algoritmi su varie tipologie di grafo.
Sviluppi futuri
Pubblicazione di BisPy su JOSS (Journal of Open Source Software);
Ricalcolo incrementale della massima bisimulazione dopo la
rimozione di un arco;
Calcolo della massima bisimulazione con labeled edges;
Integrazione con altre librerie (NetworkX);
Cython per parti critiche del codice.
Francesco Andreuzzi BisPy 8 Luglio 2021 10 / 12
Grazie per l’attenzione
Francesco Andreuzzi BisPy 8 Luglio 2021 11 / 12
Risultati sperimentali III -- Paige-Tarjan, Saha
5 6 7 8 9 10
10−3
10−2
10−1
Profondità dell’albero
Secondi
Alberi bilanciati
Paige-Tarjan
Saha
5 6 7 8 9 10
10−3
10−2
10−1
Profondità dell’albero
Raggruppamento per tipo di arco
Paige-Tarjan
Saha ∆v = 3
Saha ∆v = 0
Saha ∆v = −1
Francesco Andreuzzi BisPy 8 Luglio 2021 12 / 12

More Related Content

Featured

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 

Featured (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

BisPy: un pacchetto Python per il calcolo della massima bisimulazione di grafi diretti

  • 1. BisPy un pacchetto Python per il calcolo della massima bisimulazione di grafi diretti Francesco Andreuzzi Università degli Studi di Trieste, Dipartimento di Ingegneria e Architettura 8 Luglio 2021 Anno accademico 2020-2021 Relatore: Prof. Alberto Casagrande Francesco Andreuzzi BisPy 8 Luglio 2021 1 / 12
  • 2. Grafi orientati, terminologia V = {a, b, c, d, e} E = {ha, bi, hb, ci, ha, di, hc, ei, hd, ei} a b c d e Definizione Se ha, bi ∈ E =⇒ b è un nodo figlio di a. Un nodo privo di figli è detto pozzo. Francesco Andreuzzi BisPy 8 Luglio 2021 2 / 12
  • 3. Bisimulazione Definizione: Bisimulazione B ⊆ V × V Se (a, b) ∈ B, allora da a è possibile spostarsi verso un nodo figlio di a che sia in relazione con un nodo figlio di b, e viceversa. a c b d e f g B = {(b, c), (e, g), (d, f )} Definizione: Nodi bisimili I nodi a, b sono bisimili se esiste una bisimulazione B tale che (a, b) ∈ B. Francesco Andreuzzi BisPy 8 Luglio 2021 3 / 12
  • 4. Massima bisimulazione Definizione La massima bisimulazione su G = (V , E) è la bisimulazione BM tale che: R ⊆ BM per ogni bisimulazione R su G. Si può dimostrare che: 1 La massima bisimulazione è unica; 2 La massima bisimulazione è una relazione di equivalenza =⇒ induce un partizionamento su V ; 3 BM(a, b) ≡ [ R è una bisimulazione R; 4 BM definita come nel punto 3. è una bisimulazione. Francesco Andreuzzi BisPy 8 Luglio 2021 4 / 12
  • 5. Massima bisimulazione -- Esempio e applicazioni pratiche a c b d e f g BM = (a, a) , (b, c), (c, b) , (b, b), (c, c) , (d, d) , (e, e), (f , f ), (g, g) , (d, e), (e, d), (d, f ) , (f , d), (d, g), (g, d) , (e, f ), (f , e), (e, g) , (g, e), (f , g), (g, f ) A B C Ricerca di nodi equivalenti; Minimizzazione; Concurrency theory; XML indexing. Francesco Andreuzzi BisPy 8 Luglio 2021 5 / 12
  • 6. Algoritmi per il calcolo della massima bisimulazione Non incrementali, complessità asintotica |E| log |V | Algoritmo di Paige-Tarjan; Algoritmo di Dovier-Piazza-Policriti; BM(u, v) =⇒ rank(u) = rank(v). Incrementali Algoritmo incrementale di Saha. Francesco Andreuzzi BisPy 8 Luglio 2021 6 / 12
  • 7. BisPy Python 3; Open source (https://github.com/fAndreuzzi/BisPy); Testato su diverse tipologie di grafo, di dimensioni varie. Example from bispy import paige_tarjan # creazione del grafo graph = networkx.balanced_tree(2,3) # calcolo della massima bisimulazione paige_tarjan(graph) [(7, 8, 9, 10, 11, 12, 13, 14), (3, 4, 5, 6), (1, 2), (0,)] Francesco Andreuzzi BisPy 8 Luglio 2021 7 / 12
  • 8. Risultati sperimentali I -- Paige-Tarjan, Dovier-Piazza-Policriti 102 104 106 10−4 100 104 Numero di nodi Secondi Alberi bilanciati PT DPP a c b d e f g Un albero bilanciato. Francesco Andreuzzi BisPy 8 Luglio 2021 8 / 12
  • 9. Risultati sperimentali II -- Paige-Tarjan, Saha 0 500 1,000 1,500 2,000 10−3 10−2 Numero di nodi Tempo medio (secondi) Aggiornamento della massima bisimulazione dopo l’aggiunta di un arco Paige-Tarjan Saha 0.2 0.4 Secondi Paige-Tarjan Saha Francesco Andreuzzi BisPy 8 Luglio 2021 9 / 12
  • 10. Conclusione Il software sviluppato consente di osservare e confrontare il comportamento degli algoritmi su varie tipologie di grafo. Sviluppi futuri Pubblicazione di BisPy su JOSS (Journal of Open Source Software); Ricalcolo incrementale della massima bisimulazione dopo la rimozione di un arco; Calcolo della massima bisimulazione con labeled edges; Integrazione con altre librerie (NetworkX); Cython per parti critiche del codice. Francesco Andreuzzi BisPy 8 Luglio 2021 10 / 12
  • 11. Grazie per l’attenzione Francesco Andreuzzi BisPy 8 Luglio 2021 11 / 12
  • 12. Risultati sperimentali III -- Paige-Tarjan, Saha 5 6 7 8 9 10 10−3 10−2 10−1 Profondità dell’albero Secondi Alberi bilanciati Paige-Tarjan Saha 5 6 7 8 9 10 10−3 10−2 10−1 Profondità dell’albero Raggruppamento per tipo di arco Paige-Tarjan Saha ∆v = 3 Saha ∆v = 0 Saha ∆v = −1 Francesco Andreuzzi BisPy 8 Luglio 2021 12 / 12