SlideShare a Scribd company logo
1 of 4
Prepared by Volkan OBAN
optrees package in R
Finds optimal trees in weighted graphs. In particular, this package provid
es solving tools for minimum costspanning tree problems,minimum cost
arborescenceproblems,shortestpath tree problems and minimum cut tr
ee problem.
Examples:
Minimum Spanning Tree
>nodes <- 1:4
> arcs <- matrix(c(1,2,2, 1,3,15, 1,4,3, 2,3,1, 2,4,9, 3,4,1),
+ ncol = 3, byrow = TRUE)
> # Minimum cost spanning tree with several algorithms
> getMinimumSpanningTree(nodes, arcs, algorithm = "Prim")
Minimum Cost Spanning Tree
Algorithm: Prim
Stages: 3 | Time: 0
------------------------------
ept1 ept2 weight
1 2 2
2 3 1
3 4 1
------------------------------
Total = 4
> getMinimumSpanningTree(nodes, arcs, algorithm = "Kruskal")
Minimum Cost Spanning Tree
Algorithm: Kruskal
Stages: 3 | Time: 0
------------------------------
ept1 ept2 weight
2 3 1
3 4 1
1 2 2
------------------------------
Total = 4
> getMinimumSpanningTree(nodes, arcs, algorithm = "Boruvka")
Minimum Cost Spanning Tree
Algorithm: Boruvka
Stages: 1 | Time: 0
------------------------------
ept1 ept2 weight
1 2 2
2 3 1
3 4 1
------------------------------
Total = 4
Shortest Path Tree:
> nodes <- 1:5
> arcs <- matrix(c(1,2,2, 1,3,2, 1,4,3, 2,5,5, 3,2,4, 3,5,3, 4,3,1, 4,5,0),
+ ncol = 3, byrow = TRUE)
> # Shortest path tree
> getShortestPathTree(nodes, arcs, algorithm = "Dijkstra", directed=FALSE)
Shortest path tree
Algorithm: Dijkstra
Stages: 4 | Time: 0
------------------------------
ept1 ept2 weight
1 2 2
1 3 2
1 4 3
4 5 0
------------------------------
Total = 7
Distances from source:
------------------------------
source node distance
1 2 2
1 3 2
1 4 3
1 5 3
------------------------------
> getShortestPathTree(nodes, arcs, algorithm = "Bellman-Ford", directed=FAL
SE)
Shortest path tree
Algorithm: Bellman-Ford
Stages: 4 | Time: 0
------------------------------
ept1 ept2 weight
1 2 2
1 3 2
1 4 3
4 5 0
------------------------------
Total = 7
Distances from source:
------------------------------
source node distance
1 2 2
1 3 2
1 4 3
1 5 3
------------------------------
> # Graph with negative weights
> nodes <- 1:5
> arcs <- matrix(c(1,2,6, 1,3,7, 2,3,8, 2,4,5, 2,5,-4, 3,4,-3, 3,5,9, 4,2,-
2,
+ 5,1,2, 5,4,7), ncol = 3, byrow = TRUE)
> # Shortest path tree
> getShortestPathTree(nodes, arcs, algorithm = "Bellman-Ford", directed=TRU
E)
Shortest path tree
Algorithm: Bellman-Ford
Stages: 4 | Time: 0.09
------------------------------
head tail weight
1 3 7
2 5 -4
3 4 -3
4 2 -2
------------------------------
Total = -2
Distances from source:
------------------------------
source node distance
1 2 2
1 3 7
1 4 4
1 5 -2
------------------------------
Maximum flow:
> # Graph
> nodes <- 1:6
> arcs <- matrix(c(1,2,1, 1,3,7, 2,3,1, 2,4,3, 2,5,2, 3,5,4, 4,5,1, 4,6,6,
+ 5,6,2), byrow = TRUE, ncol = 3)
> # Maximum flow with Ford-Fulkerson algorithm
> maxFlowFordFulkerson(nodes, arcs, source.node = 2, sink.node = 6)
$s.cut
[1] 2 3 1 5
$t.cut
[1] 4 6
$max.flow
[1] 6

More Related Content

What's hot

Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...Een Pahlefi
 
Modul dhcp server menggunakan mikrotik os
Modul dhcp server menggunakan mikrotik osModul dhcp server menggunakan mikrotik os
Modul dhcp server menggunakan mikrotik osEen Pahlefi
 
EE402B Radio Systems and Personal Communication Networks notes
EE402B Radio Systems and Personal Communication Networks notesEE402B Radio Systems and Personal Communication Networks notes
EE402B Radio Systems and Personal Communication Networks notesHaris Hassan
 
Ramco C Question Paper 2003
Ramco  C  Question  Paper 2003Ramco  C  Question  Paper 2003
Ramco C Question Paper 2003ncct
 
Backup and restore router configuration
Backup and restore router configurationBackup and restore router configuration
Backup and restore router configurationVasilis Nikitaras
 
Wired Network Simulation in NS2 Research Guidance
Wired Network Simulation in NS2 Research GuidanceWired Network Simulation in NS2 Research Guidance
Wired Network Simulation in NS2 Research GuidanceNetwork Simulation Tools
 

What's hot (8)

Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
 
Modul dhcp server menggunakan mikrotik os
Modul dhcp server menggunakan mikrotik osModul dhcp server menggunakan mikrotik os
Modul dhcp server menggunakan mikrotik os
 
Remote Pattern
Remote PatternRemote Pattern
Remote Pattern
 
EE402B Radio Systems and Personal Communication Networks notes
EE402B Radio Systems and Personal Communication Networks notesEE402B Radio Systems and Personal Communication Networks notes
EE402B Radio Systems and Personal Communication Networks notes
 
Ramco C Question Paper 2003
Ramco  C  Question  Paper 2003Ramco  C  Question  Paper 2003
Ramco C Question Paper 2003
 
Backup and restore router configuration
Backup and restore router configurationBackup and restore router configuration
Backup and restore router configuration
 
Vpn addind technique
Vpn addind techniqueVpn addind technique
Vpn addind technique
 
Wired Network Simulation in NS2 Research Guidance
Wired Network Simulation in NS2 Research GuidanceWired Network Simulation in NS2 Research Guidance
Wired Network Simulation in NS2 Research Guidance
 

Similar to "optrees" package in R and examples.(optrees:finds optimal trees in weighted graphs)

The LCA problem revisited
The LCA problem revisitedThe LCA problem revisited
The LCA problem revisitedMinsung Hong
 
Longest Common Subsequence & Matrix Chain Multiplication
Longest Common Subsequence & Matrix Chain MultiplicationLongest Common Subsequence & Matrix Chain Multiplication
Longest Common Subsequence & Matrix Chain MultiplicationJaneAlamAdnan
 
Simulation example with matlab
Simulation example with matlabSimulation example with matlab
Simulation example with matlabRoma Larumbia
 
Same plan different performance
Same plan different performanceSame plan different performance
Same plan different performanceMauro Pagano
 
My presentation all shortestpath
My presentation all shortestpathMy presentation all shortestpath
My presentation all shortestpathCarlostheran
 
Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)Cdiscount
 
Branch and bounding : Data structures
Branch and bounding : Data structuresBranch and bounding : Data structures
Branch and bounding : Data structuresKàŕtheek Jåvvàjí
 
Simple, fast, and scalable torch7 tutorial
Simple, fast, and scalable torch7 tutorialSimple, fast, and scalable torch7 tutorial
Simple, fast, and scalable torch7 tutorialJin-Hwa Kim
 
Scilab presentation
Scilab presentation Scilab presentation
Scilab presentation Nasir Ansari
 
Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportMuragesh Kabbinakantimath
 
Adapting to Adaptive Plans on 12c
Adapting to Adaptive Plans on 12cAdapting to Adaptive Plans on 12c
Adapting to Adaptive Plans on 12cMauro Pagano
 
Soham Patra_13000120121.pdf
Soham Patra_13000120121.pdfSoham Patra_13000120121.pdf
Soham Patra_13000120121.pdfPritamDutta66
 
On the Construction of Cantor like Sets
On the Construction of Cantor like SetsOn the Construction of Cantor like Sets
On the Construction of Cantor like Setstheijes
 
On the Construction of Cantor like Sets
	On the Construction of Cantor like Sets	On the Construction of Cantor like Sets
On the Construction of Cantor like Setstheijes
 
Datastage real time scenario
Datastage real time scenarioDatastage real time scenario
Datastage real time scenarioNaresh Bala
 
asymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysisasymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysisAnindita Kundu
 

Similar to "optrees" package in R and examples.(optrees:finds optimal trees in weighted graphs) (20)

Rbootcamp Day 5
Rbootcamp Day 5Rbootcamp Day 5
Rbootcamp Day 5
 
The LCA problem revisited
The LCA problem revisitedThe LCA problem revisited
The LCA problem revisited
 
Longest Common Subsequence & Matrix Chain Multiplication
Longest Common Subsequence & Matrix Chain MultiplicationLongest Common Subsequence & Matrix Chain Multiplication
Longest Common Subsequence & Matrix Chain Multiplication
 
Simulation example with matlab
Simulation example with matlabSimulation example with matlab
Simulation example with matlab
 
Same plan different performance
Same plan different performanceSame plan different performance
Same plan different performance
 
My presentation all shortestpath
My presentation all shortestpathMy presentation all shortestpath
My presentation all shortestpath
 
Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)
 
Multirate sim
Multirate simMultirate sim
Multirate sim
 
Branch and bounding : Data structures
Branch and bounding : Data structuresBranch and bounding : Data structures
Branch and bounding : Data structures
 
Network flow
Network flowNetwork flow
Network flow
 
Simple, fast, and scalable torch7 tutorial
Simple, fast, and scalable torch7 tutorialSimple, fast, and scalable torch7 tutorial
Simple, fast, and scalable torch7 tutorial
 
Scilab presentation
Scilab presentation Scilab presentation
Scilab presentation
 
Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks report
 
Adapting to Adaptive Plans on 12c
Adapting to Adaptive Plans on 12cAdapting to Adaptive Plans on 12c
Adapting to Adaptive Plans on 12c
 
Square Root Decomposition
Square Root DecompositionSquare Root Decomposition
Square Root Decomposition
 
Soham Patra_13000120121.pdf
Soham Patra_13000120121.pdfSoham Patra_13000120121.pdf
Soham Patra_13000120121.pdf
 
On the Construction of Cantor like Sets
On the Construction of Cantor like SetsOn the Construction of Cantor like Sets
On the Construction of Cantor like Sets
 
On the Construction of Cantor like Sets
	On the Construction of Cantor like Sets	On the Construction of Cantor like Sets
On the Construction of Cantor like Sets
 
Datastage real time scenario
Datastage real time scenarioDatastage real time scenario
Datastage real time scenario
 
asymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysisasymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysis
 

More from Dr. Volkan OBAN

Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...Dr. Volkan OBAN
 
Covid19py Python Package - Example
Covid19py  Python Package - ExampleCovid19py  Python Package - Example
Covid19py Python Package - ExampleDr. Volkan OBAN
 
Object detection with Python
Object detection with Python Object detection with Python
Object detection with Python Dr. Volkan OBAN
 
Python - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) ParametreleriPython - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) ParametreleriDr. Volkan OBAN
 
Linear Programming wi̇th R - Examples
Linear Programming wi̇th R - ExamplesLinear Programming wi̇th R - Examples
Linear Programming wi̇th R - ExamplesDr. Volkan OBAN
 
k-means Clustering in Python
k-means Clustering in Pythonk-means Clustering in Python
k-means Clustering in PythonDr. Volkan OBAN
 
Naive Bayes Example using R
Naive Bayes Example using  R Naive Bayes Example using  R
Naive Bayes Example using R Dr. Volkan OBAN
 
k-means Clustering and Custergram with R
k-means Clustering and Custergram with Rk-means Clustering and Custergram with R
k-means Clustering and Custergram with RDr. Volkan OBAN
 
Data Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision MakingData Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision MakingDr. Volkan OBAN
 
Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.Dr. Volkan OBAN
 
Scikit-learn Cheatsheet-Python
Scikit-learn Cheatsheet-PythonScikit-learn Cheatsheet-Python
Scikit-learn Cheatsheet-PythonDr. Volkan OBAN
 
Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet Dr. Volkan OBAN
 
Pandas,scipy,numpy cheatsheet
Pandas,scipy,numpy cheatsheetPandas,scipy,numpy cheatsheet
Pandas,scipy,numpy cheatsheetDr. Volkan OBAN
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleDr. Volkan OBAN
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleDr. Volkan OBAN
 
R-ggplot2 package Examples
R-ggplot2 package ExamplesR-ggplot2 package Examples
R-ggplot2 package ExamplesDr. Volkan OBAN
 
R Machine Learning packages( generally used)
R Machine Learning packages( generally used)R Machine Learning packages( generally used)
R Machine Learning packages( generally used)Dr. Volkan OBAN
 
treemap package in R and examples.
treemap package in R and examples.treemap package in R and examples.
treemap package in R and examples.Dr. Volkan OBAN
 

More from Dr. Volkan OBAN (20)

Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
 
Covid19py Python Package - Example
Covid19py  Python Package - ExampleCovid19py  Python Package - Example
Covid19py Python Package - Example
 
Object detection with Python
Object detection with Python Object detection with Python
Object detection with Python
 
Python - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) ParametreleriPython - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) Parametreleri
 
Linear Programming wi̇th R - Examples
Linear Programming wi̇th R - ExamplesLinear Programming wi̇th R - Examples
Linear Programming wi̇th R - Examples
 
k-means Clustering in Python
k-means Clustering in Pythonk-means Clustering in Python
k-means Clustering in Python
 
Naive Bayes Example using R
Naive Bayes Example using  R Naive Bayes Example using  R
Naive Bayes Example using R
 
R forecasting Example
R forecasting ExampleR forecasting Example
R forecasting Example
 
k-means Clustering and Custergram with R
k-means Clustering and Custergram with Rk-means Clustering and Custergram with R
k-means Clustering and Custergram with R
 
Data Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision MakingData Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision Making
 
Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.
 
Scikit-learn Cheatsheet-Python
Scikit-learn Cheatsheet-PythonScikit-learn Cheatsheet-Python
Scikit-learn Cheatsheet-Python
 
Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet
 
Pandas,scipy,numpy cheatsheet
Pandas,scipy,numpy cheatsheetPandas,scipy,numpy cheatsheet
Pandas,scipy,numpy cheatsheet
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an example
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an example
 
R-ggplot2 package Examples
R-ggplot2 package ExamplesR-ggplot2 package Examples
R-ggplot2 package Examples
 
R Machine Learning packages( generally used)
R Machine Learning packages( generally used)R Machine Learning packages( generally used)
R Machine Learning packages( generally used)
 
treemap package in R and examples.
treemap package in R and examples.treemap package in R and examples.
treemap package in R and examples.
 
Mosaic plot in R.
Mosaic plot in R.Mosaic plot in R.
Mosaic plot in R.
 

Recently uploaded

VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
 
Predicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project PresentationPredicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project PresentationBoston Institute of Analytics
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一ffjhghh
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 

Recently uploaded (20)

VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
 
Predicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project PresentationPredicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project Presentation
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 

"optrees" package in R and examples.(optrees:finds optimal trees in weighted graphs)

  • 1. Prepared by Volkan OBAN optrees package in R Finds optimal trees in weighted graphs. In particular, this package provid es solving tools for minimum costspanning tree problems,minimum cost arborescenceproblems,shortestpath tree problems and minimum cut tr ee problem. Examples: Minimum Spanning Tree >nodes <- 1:4 > arcs <- matrix(c(1,2,2, 1,3,15, 1,4,3, 2,3,1, 2,4,9, 3,4,1), + ncol = 3, byrow = TRUE) > # Minimum cost spanning tree with several algorithms > getMinimumSpanningTree(nodes, arcs, algorithm = "Prim") Minimum Cost Spanning Tree Algorithm: Prim Stages: 3 | Time: 0 ------------------------------ ept1 ept2 weight 1 2 2 2 3 1 3 4 1 ------------------------------ Total = 4 > getMinimumSpanningTree(nodes, arcs, algorithm = "Kruskal") Minimum Cost Spanning Tree Algorithm: Kruskal Stages: 3 | Time: 0
  • 2. ------------------------------ ept1 ept2 weight 2 3 1 3 4 1 1 2 2 ------------------------------ Total = 4 > getMinimumSpanningTree(nodes, arcs, algorithm = "Boruvka") Minimum Cost Spanning Tree Algorithm: Boruvka Stages: 1 | Time: 0 ------------------------------ ept1 ept2 weight 1 2 2 2 3 1 3 4 1 ------------------------------ Total = 4 Shortest Path Tree: > nodes <- 1:5 > arcs <- matrix(c(1,2,2, 1,3,2, 1,4,3, 2,5,5, 3,2,4, 3,5,3, 4,3,1, 4,5,0), + ncol = 3, byrow = TRUE) > # Shortest path tree > getShortestPathTree(nodes, arcs, algorithm = "Dijkstra", directed=FALSE) Shortest path tree Algorithm: Dijkstra Stages: 4 | Time: 0 ------------------------------ ept1 ept2 weight 1 2 2 1 3 2 1 4 3 4 5 0 ------------------------------ Total = 7 Distances from source: ------------------------------ source node distance 1 2 2 1 3 2 1 4 3 1 5 3 ------------------------------ > getShortestPathTree(nodes, arcs, algorithm = "Bellman-Ford", directed=FAL SE) Shortest path tree
  • 3. Algorithm: Bellman-Ford Stages: 4 | Time: 0 ------------------------------ ept1 ept2 weight 1 2 2 1 3 2 1 4 3 4 5 0 ------------------------------ Total = 7 Distances from source: ------------------------------ source node distance 1 2 2 1 3 2 1 4 3 1 5 3 ------------------------------ > # Graph with negative weights > nodes <- 1:5 > arcs <- matrix(c(1,2,6, 1,3,7, 2,3,8, 2,4,5, 2,5,-4, 3,4,-3, 3,5,9, 4,2,- 2, + 5,1,2, 5,4,7), ncol = 3, byrow = TRUE) > # Shortest path tree > getShortestPathTree(nodes, arcs, algorithm = "Bellman-Ford", directed=TRU E) Shortest path tree Algorithm: Bellman-Ford Stages: 4 | Time: 0.09 ------------------------------ head tail weight 1 3 7 2 5 -4 3 4 -3 4 2 -2 ------------------------------ Total = -2 Distances from source: ------------------------------ source node distance 1 2 2 1 3 7 1 4 4 1 5 -2 ------------------------------ Maximum flow: > # Graph > nodes <- 1:6 > arcs <- matrix(c(1,2,1, 1,3,7, 2,3,1, 2,4,3, 2,5,2, 3,5,4, 4,5,1, 4,6,6, + 5,6,2), byrow = TRUE, ncol = 3) > # Maximum flow with Ford-Fulkerson algorithm
  • 4. > maxFlowFordFulkerson(nodes, arcs, source.node = 2, sink.node = 6) $s.cut [1] 2 3 1 5 $t.cut [1] 4 6 $max.flow [1] 6