Skip to content

Commit

Permalink
Added source code and binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
esteban-mendoza committed May 26, 2020
1 parent f5a8840 commit 014704f
Show file tree
Hide file tree
Showing 15 changed files with 337 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Binaries/PackagingLog.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<html><meta charset="UTF-8"><pre>
<font color=blue>mcc -o Kruskal -W 'WinMain:Kruskal,version=1.0' -T link:exe -d C:\Users\esteb\Desktop\Kruskal\Kruskal\for_testing -v C:\Users\esteb\Desktop\Kruskal\KruskalAppEditor.mlapp -r 'C:\Program Files\MATLAB\R2020a\toolbox\compiler\resources\default_icon.ico' </font>
Compiler version: 8.0 (R2020a)

Dependency analysis by REQUIREMENTS.

Parsing file "C:\Users\esteb\Desktop\Kruskal\KruskalAppEditor.mlapp"
(referenced from command line).
Generating file "C:\Users\esteb\Desktop\Kruskal\Kruskal\for_testing\readme.txt".
<font color=blue>Packaging...</font>
Creating the bundle...
Creating the install agent URL file...
Web based installer created at C:\Users\esteb\Desktop\Kruskal\Kruskal\for_redistribution\MyAppInstaller_web.exe.
Packaging complete.
Elapsed packaging time was: 18 seconds.
</pre></html>
Binary file not shown.
Binary file not shown.
47 changes: 47 additions & 0 deletions Binaries/for_redistribution_files_only/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Kruskal Executable

1. Prerequisites for Deployment

Verify that version 9.8 (R2020a) of the MATLAB Runtime is installed.
If not, you can run the MATLAB Runtime installer.
To find its location, enter

>>mcrinstaller

at the MATLAB prompt.
NOTE: You will need administrator rights to run the MATLAB Runtime installer.

Alternatively, download and install the Windows version of the MATLAB Runtime for R2020a
from the following link on the MathWorks website:

https://www.mathworks.com/products/compiler/mcr/index.html

For more information about the MATLAB Runtime and the MATLAB Runtime installer, see
"Distribute Applications" in the MATLAB Compiler documentation
in the MathWorks Documentation Center.

2. Files to Deploy and Package

Files to Package for Standalone
================================
-Kruskal.exe
-MCRInstaller.exe
Note: if end users are unable to download the MATLAB Runtime using the
instructions in the previous section, include it when building your
component by clicking the "Runtime included in package" link in the
Deployment Tool.
-This readme file



3. Definitions

For information on deployment terminology, go to
https://www.mathworks.com/help and select MATLAB Compiler >
Getting Started > About Application Deployment >
Deployment Product Terms in the MathWorks Documentation
Center.




Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Binaries/for_testing/Kruskal.exe
Binary file not shown.
2 changes: 2 additions & 0 deletions Binaries/for_testing/mccExcludedFiles.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The List of Excluded Files
Excluded files Exclusion Message ID Reason For Exclusion Exclusion Rule
47 changes: 47 additions & 0 deletions Binaries/for_testing/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Kruskal Executable

1. Prerequisites for Deployment

Verify that version 9.8 (R2020a) of the MATLAB Runtime is installed.
If not, you can run the MATLAB Runtime installer.
To find its location, enter

>>mcrinstaller

at the MATLAB prompt.
NOTE: You will need administrator rights to run the MATLAB Runtime installer.

Alternatively, download and install the Windows version of the MATLAB Runtime for R2020a
from the following link on the MathWorks website:

https://www.mathworks.com/products/compiler/mcr/index.html

For more information about the MATLAB Runtime and the MATLAB Runtime installer, see
"Distribute Applications" in the MATLAB Compiler documentation
in the MathWorks Documentation Center.

2. Files to Deploy and Package

Files to Package for Standalone
================================
-Kruskal.exe
-MCRInstaller.exe
Note: if end users are unable to download the MATLAB Runtime using the
instructions in the previous section, include it when building your
component by clicking the "Runtime included in package" link in the
Deployment Tool.
-This readme file



3. Definitions

For information on deployment terminology, go to
https://www.mathworks.com/help and select MATLAB Compiler >
Getting Started > About Application Deployment >
Deployment Product Terms in the MathWorks Documentation
Center.




1 change: 1 addition & 0 deletions Binaries/for_testing/requiredMCRProducts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
35000 35010
Binary file added Binaries/for_testing/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions EjemploKruskal.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
% Cell con nombres de nodos
names = {'A', 'B', 'C', 'D', 'E', 'F', 'G'};

% Matriz de adyacencias
A = [0 2 3 3 0 0 0;
0 0 4 0 3 0 0;
0 0 0 5 1 0 0;
0 0 0 0 0 7 0;
0 0 0 0 0 8 0;
0 0 0 0 0 0 9;
0 0 0 0 0 0 0];

% Crear grafo no-dirigido, con pesos y nombres usando
% una matriz de adyacencias triangular superior
G = graph(A, names, 'upper');

% Crear visualización del grafo con los pesos en las etiquetas de las aristas
h = plot(G, 'EdgeLabel', G.Edges.Weight)

% Usar algoritmo de Kruskal para obtener árbol generador de peso mínimo
T = MinimumSpanTree(G);

% Sobresaltar aristas del árbol generador de peso mínimo
highlight(h, T, 'EdgeColor', 'r', 'LineWidth', 1.5)
114 changes: 114 additions & 0 deletions Kruskal.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<deployment-project plugin="plugin.ezdeploy" plugin-version="1.0">
<configuration build-checksum="3551984088" file="C:\Users\esteb\Desktop\Kruskal\Kruskal.prj" location="C:\Users\esteb\Desktop\Kruskal" name="Kruskal" preferred-package-location="C:\Users\esteb\Desktop\Kruskal\Kruskal\for_redistribution" preferred-package-type="package.type.exe" target="target.ezdeploy.standalone" target-name="Application Compiler">
<param.appname>Kruskal</param.appname>
<param.icon />
<param.icons />
<param.version>1.0</param.version>
<param.authnamewatermark />
<param.email />
<param.company />
<param.summary />
<param.description />
<param.screenshot />
<param.guid />
<param.installpath.string>\Kruskal\</param.installpath.string>
<param.installpath.combo>option.installpath.programfiles</param.installpath.combo>
<param.logo />
<param.install.notes />
<param.target.install.notes />
<param.intermediate>${PROJECT_ROOT}\Kruskal\for_testing</param.intermediate>
<param.files.only>${PROJECT_ROOT}\Kruskal\for_redistribution_files_only</param.files.only>
<param.output>${PROJECT_ROOT}\Kruskal\for_redistribution</param.output>
<param.logdir>${PROJECT_ROOT}\Kruskal</param.logdir>
<param.enable.clean.build>false</param.enable.clean.build>
<param.user.defined.mcr.options />
<param.target.type>subtarget.standalone</param.target.type>
<param.support.packages />
<param.web.mcr>true</param.web.mcr>
<param.package.mcr>false</param.package.mcr>
<param.no.mcr>false</param.no.mcr>
<param.web.mcr.name>MyAppInstaller_web</param.web.mcr.name>
<param.package.mcr.name>MyAppInstaller_mcr</param.package.mcr.name>
<param.no.mcr.name>MyAppInstaller_app</param.no.mcr.name>
<param.windows.command.prompt>true</param.windows.command.prompt>
<param.create.log>false</param.create.log>
<param.log.file />
<param.native.matlab>false</param.native.matlab>
<param.checkbox>false</param.checkbox>
<param.example />
<param.help.text>Syntax
-?

Input Arguments
-? print help on how to use the application
input arguments</param.help.text>
<unset>
<param.icon />
<param.icons />
<param.version />
<param.authnamewatermark />
<param.email />
<param.company />
<param.summary />
<param.description />
<param.screenshot />
<param.guid />
<param.installpath.string />
<param.installpath.combo />
<param.logo />
<param.install.notes />
<param.target.install.notes />
<param.intermediate />
<param.files.only />
<param.output />
<param.logdir />
<param.enable.clean.build />
<param.user.defined.mcr.options />
<param.target.type />
<param.support.packages />
<param.web.mcr />
<param.package.mcr />
<param.no.mcr />
<param.web.mcr.name />
<param.package.mcr.name />
<param.no.mcr.name />
<param.windows.command.prompt />
<param.create.log />
<param.log.file />
<param.native.matlab />
<param.checkbox />
<param.example />
</unset>
<fileset.main>
<file>${PROJECT_ROOT}\KruskalAppEditor.mlapp</file>
</fileset.main>
<fileset.resources />
<fileset.package />
<fileset.depfun />
<build-deliverables>
<file location="${PROJECT_ROOT}\Kruskal\for_testing" name="readme.txt" optional="true">C:\Users\esteb\Desktop\Kruskal\Kruskal\for_testing\readme.txt</file>
<file location="${PROJECT_ROOT}\Kruskal\for_testing" name="Kruskal.exe" optional="false">C:\Users\esteb\Desktop\Kruskal\Kruskal\for_testing\Kruskal.exe</file>
<file location="${PROJECT_ROOT}\Kruskal\for_testing" name="splash.png" optional="false">C:\Users\esteb\Desktop\Kruskal\Kruskal\for_testing\splash.png</file>
</build-deliverables>
<workflow />
<matlab>
<root>C:\Program Files\MATLAB\R2020a</root>
<toolboxes />
</matlab>
<platform>
<unix>false</unix>
<mac>false</mac>
<windows>true</windows>
<win2k>false</win2k>
<winxp>false</winxp>
<vista>false</vista>
<linux>false</linux>
<solaris>false</solaris>
<osver>10.0</osver>
<os32>false</os32>
<os64>true</os64>
<arch>win64</arch>
<matlab>true</matlab>
</platform>
</configuration>
</deployment-project>
Binary file added KruskalAppEditor.mlapp
Binary file not shown.
79 changes: 79 additions & 0 deletions MinimumSpanTree.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
function MST = MinimumSpanTree(Graph)

% Iniciar Minimum Spanning Tree (MST) con arista de peso mínimo
MST = graph();

% Ordenar y obtener arista y peso de la arista del peso mínimo
minEdge = sortrows(Graph.Edges, 'Weight').EndNodes(1,:);
minWeight = sortrows(Graph.Edges, 'Weight').Weight(1,:);

MST = MST.addedge(minEdge(1), minEdge(2), minWeight);

% Eliminar vértice de Graph
Graph = Graph.rmedge(minEdge(1), minEdge(2));

% Mientras haya aristas en Graph, seguir iterando
while (~isempty(Graph.Edges))

% subgráfica de G adyacente a MST
subG = adjacentSubgraph(Graph, MST);

% Arista de peso mínimo
minEdge = sortrows(subG.Edges, 'Weight').EndNodes(1,:);
minWeight = sortrows(subG.Edges, 'Weight').Weight(1,:);

% Número de nodos de la arista que aparecen en el grafo
N = countNodes(MST, minEdge);

% Si ninguno o sólo uno de los nodos aparecen, agregar
% la arista al árbol generador y borrarla de G
if N < 2
MST = MST.addedge(minEdge(1), minEdge(2), minWeight);
end

% Eliminar arista de G
Graph = Graph.rmedge(minEdge(1), minEdge(2));
end

end


function subG = adjacentSubgraph(G, F)
% Obtiene la subgráfica de G con las aristas que incluyen a nodos en F
% F es una subgráfica de G

% Nodos de Graph y SubGraph
GNodes = unique(G.Edges.EndNodes);
FNodes = unique(F.Edges.EndNodes);

% Intersección de nodos
Nodes = intersect(GNodes, FNodes);

% Subgráfica resultante
subG = graph();

for i = 1:length(Nodes)

% id's de aristas que incluyen a node
eid = G.outedges(Nodes(i));

% EdgeTable de las aristas que incluyen a node
tEdges = G.Edges(eid,:);

% Agregar aristas elegidas a subGraph
subG = subG.addedge(tEdges);
end

end


function n = countNodes(G, edge)
% Cuenta el número de nodos de la arista que están en el grafo

% Conjunto de nodos en el grafo G
nodes = unique(G.Edges.EndNodes);

% Devuelve el máximo número de veces
n = sum(ismember(edge, nodes));

end
7 changes: 7 additions & 0 deletions adjacencyMatrix.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
0, 2, 3, 3, 0, 0, 0
0, 0, 4, 0, 3, 0, 0
0, 0, 0, 5, 1, 0, 0
0, 0, 0, 0, 0, 7, 0
0, 0, 0, 0, 0, 8, 0
0, 0, 0, 0, 0, 0, 9
0, 0, 0, 0, 0, 0, 0

0 comments on commit 014704f

Please sign in to comment.