domingo, 31 de agosto de 2014

Matriz de accesibilidad de un Digrafo en c++ – Virginia – Platform – cancer

digrafos en c++

ParaDigrafos existe un procedimiento para encontrar lamatriz de accesibilidad, podemos determinar la matriz de accesibilidad a través de una serie de pasos. La matriz de accesibilidad nos brinda información sobre si el digrafo es F.C (fuertemente conexo) o no, es decir si para cada par de vértices u,v:u es accesible desdev yv es accesible desdeu.
Al observar la matriz sí notamos que hay al menos un elemento igual a cero diremos que el digrafo no es F.C conexo. De lo contrario, si es F.C.

La matriz de accesibilidad de un Digrafo es:

Acc(D) = bin[In+ M+ M^2+ M^3+ ...+ M^n-1]

M es la matriz de conexión del digrafo, determinaremos M^2, M^3 hasta M^n-1donde n es el número de vértices del digrafo.

Luego de determinar las matrices antes mencionadas las sumaremos junto a la matriz identidad y ese resultado procederemos a binarizarlo (Los elementos mayores que 1 los haremos igual a 1, los elementos que sean igual a 0 seguirán siendo igual a 0).

Ejercicio de ejemplo:

Dada la matriz de conexión del siguiente digrafo, determinar su matriz de accesibilidad.

matriz de Digrafo

M=

matriz de Digrafo

M^2 = MxM

matriz de Digrafo

M^3 = M^2 * M

matriz de Digrafo

M^4 = M^3 * M

matriz de Digrafo

I5 =

matriz identidad

Acc(D) = bin[In+ M+ M^2+ M^3+ ...+ M^n-1]

Acc(D) =

matriz de accesibilidad de un digrafo

De esta manera podemos obtener la matriz de accesibilidad del digrafo. Este digrafo no es fuertemente conexo, debido a que su matriz de accesibilidad posee componentes nulas.

EnC++ Estos pasos para determinar sí el digrafo es F.C o no, los podemos realizar de la siguiente manera:

#include iostream

using namespace std;

int main(){
int vertices;
cout "Ingrese la cantidad de vertices del digrafo:" endl;
cin vertices;
int matrizC[vertices][vertices];
int matrizaux[vertices][vertices];
int matrizM[vertices][vertices];
int matrizAcc[vertices][vertices];
//Cargamos la matriz de conexion
cout "Ingrese los elementos de la matriz de conexion: " endl;
for(int i = 0; i vertices; i++){
for(int j = 0; j vertices; j++){
cout "Ingrese la entrada a" i j endl;
cin matrizC[i][j];
}
}

for(int i = 0; i vertices; i++){
for(int j = 0; j vertices; j++){
matrizaux[i][j] = matrizC[i][j];
matrizAcc[i][j] = matrizC[i][j];
}
}
//ciclo
int cont = vertices-2;
while(cont){
// Producto para M...
for(int i=0;ivertices;i++){
for(int j=0;jvertices;j++){
matrizM[i][j]=0;
for(int k=0;kvertices;k++){
matrizM[i][j]=matrizM[i][j]+(matrizC[i][k]*matrizaux[k][j]);
}
}
}
//Sumamos para la matriz de accesibilidad
for(int i = 0; i vertices; i++){
for(int j = 0; j vertices; j++){
matrizAcc[i][j] += matrizM[i][j];
matrizaux[i][j] = matrizM[i][j];
}
}
cont--;
}//Fin del ciclo

//Sumar matriz de indentidad y binarizar
for(int i = 0; i vertices; i++){
for(int j = 0; j vertices; j++){
if(i == j)
matrizAcc[i][j] = 1;
if(matrizAcc[i][j] 1)
matrizAcc[i][j] = 1;
}
}

//Imprimimos la matriz de accesibilidad
cout "Matriz de accesibilidad:" endl;
for(int i = 0; i vertices; i++){
for(int j = 0; j vertices; j++){
cout matrizAcc[i][j] " ";
}
cout endl;
}


return 0;
}

Inicialmente ingresamos el numero de vértices del digrafo, las matrices con las que vamos a trabajar son de orden nxn donde n es el numero de vértices del digrafo.
El ciclo while se repetirá mientras la variable cont sea distinta de 0 (n - 2 veces debido a que M^2 se calcula fuera del ciclo while), esta variable irá decreciendo de uno en uno en cada repetición del ciclo.
Mientras vamos realizando la multiplicación de las matrices vamos sumando los resultados en la matriz de accesibilidad.
Al final, luego de salir del ciclo sumamos la matriz identidad y binarizamos la matriz de accesibilidad.

Ejecución:

Ingrese la cantidad de vertices del digrafo:
5
Ingrese los elementos de la matriz de conexion:
Ingrese la entrada a00
0
Ingrese la entrada a01
1
Ingrese la entrada a02
0
Ingrese la entrada a03
0
Ingrese la entrada a04
0
Ingrese la entrada a10
1
Ingrese la entrada a11
0
Ingrese la entrada a12
1
Ingrese la entrada a13
0
Ingrese la entrada a14
1
Ingrese la entrada a20
0
Ingrese la entrada a21
0
Ingrese la entrada a22
0
Ingrese la entrada a23
0
Ingrese la entrada a24
0
Ingrese la entrada a30
0
Ingrese la entrada a31
1
Ingrese la entrada a32
0
Ingrese la entrada a33
0
Ingrese la entrada a34
0
Ingrese la entrada a40
0
Ingrese la entrada a41
1
Ingrese la entrada a42
1
Ingrese la entrada a43
1
Ingrese la entrada a44
0
Matriz de accesibilidad:
1 1 1 1 1
1 1 1 1 1
0 0 1 0 0
1 1 1 1 1
1 1 1 1 1

Descarga del proyecto en C++:
https://mega.co.nz/#!ZBETVRqK!eVh_8o...


También te podría interesar:
Algoritmo para calcular la matriz de la relación predecesor inmediato a partir de la matriz de la relación de orden en c++.
4 Ejercicios Básicos de Programación Orientada a Objetos en c++
eBook - Como programar en c++ Deitel
De sistema decimal a sistema binario en c++ y Java
3 libros sobre programacion orientada a objetos


BEST CRIMINAL LAWYER IN ARIZONA WordPress hosting car accident lawyers Criminal defense lawyer best consolidation loan student accident attorney in los angeles Car Insurance in South Dakota Business finance group Asbestos Lawyers CAR INSURANCE IN SOUTH DAKOTA asbestos lawyers personal injury accident lawyer Live casino Online casino Seo company Make money online Australia maritime lawyer houston Psychic for Free Php programmers for hire Donating a car in Maryland Hire php developer MESOTHELIOMA LAW FIRM Donate a Car in Maryland Online classes Casino Futuristic architecture donate your car for kids Service business software Mortgage cash out structured settlement selling annuity payments for cash Mobile casino Futuristic Architecture Donate Cars Illinois Criminal lawyer Injury Lawyers mesotheioma Hire php developers Best Criminal Lawyers in Arizona Best Seo company Webex Costs meso lawyer Casino reviews structured settlement cash out DUI lawyer Online Criminal Justice Degree donate old cars to charity adverse credit remortgage cheap car insurance in virginia Paperport Promotional Code Online College Course Best social media platforms for business mesothelioma compensation Hire php programmers WordPress themes for designers car insurance quotes mn st louis mesothelioma attorney Computer science classes online Online Stock Trading structured settlement brokers Car Donate Dwi lawyer saskatchewan auto insurance Social media examiner mesothelioma lawyer texas Cheap Car Insurance for Ladies Dallas Mesothelioma Attorneys Mesothelioma Law Firm Forensics Online Course Best social media platforms Donate cars in ma mesothelioma attorneys Car Accident Lawyers ASBESTOS LAWYERS mesothelioma drug mesothelioma attorney Car Insurance Quotes MN insurance medical temporary fast cash for house car insurance quotes pa peritoneal mesothelioma Social media platforms for business Automobile Accident Attorney Register free domains Cheap domain registration hosting alabama mesothelioma lawyer Bankruptcy lawyer DONATING A CAR IN MARYLAND mesothelioma attorney directory Donate Your Car for Kids better conferencing calls Social media campaigns CHEAP AUTO INSURANCE IN VA Motor Replacements New social media platforms Life insurance co Lincoln lease management software personal injury attorney springfield mo mesotheliama Php programmers anti spam exchange server Neuson Holland Michigan College Seo companies Criminal lawyer Miami Car Insurance Quotes Utah Donating Used Cars to Charity Custom Christmas cards business email web hosting criminal defense attorneys florida WordPress theme designers Custom WordPress theme designer Seo services domain registration yahoo Auto Mobile Shipping Quote Online Motor Insurance Quotes Business management software injury lawyers structured settlemen MORTGAGE ADVISER Online Christmas cards structured settlement quote buying structured settlements automobile accident attorney how to donate a car in california Dayton freight lines criminal defense federal lawyer seattle mesothelioma lawyer Photo Christmas cards florida car insurance company anti spam appliance STRUCTURED ANNUITY SETTLEMENT buy structured settlements BETTER CONFERENCING CALLS HARDDRIVE DATA RECOVERY SERVICES Car insurance quotes pa sell structured settlement calculator Donate Cars in MA Social media strategies michigan motorcycle accident lawyer Psd to WordPress AUTOMOBILE ACCIDENT ATTORNEY accident car florida lawyer structured settlement need cash now Html email Social media management Tech school Social media platforms Nunavut Culture Christmas cards Proud Italian cook buying an annuity calculator Psd to html cheap domain registration hosting DONATE CARS ILLINOIS HOME PHONE INTERNET BUNDLE Italian cooking school email bulk service HOW TO DONATE A CAR IN CALIFORNIA ONLINECLASSES sell your structured settlement payments Cheap Car Insurance in Virginia Dayton Freight Lines Adobe illustrator classes asbestos lung cancer home phone internet bundle Learning adobe illustrator Social media tools tennessee mesothelioma lawyer chicago hair laser removal mesotheolima Car insurance quotes MN motorcycle accident attorney sacramento Donate Car to Charity California Donate Car for Tax Credit Donate Your Car Sacramento How to Donate A Car in California phd in counseling education asbestos exposure lawyers Sell Annuity Payment hughes net business student loan consolidation program Structures Annuity Settlement most profitable internet business Car Insurance Quotes Colorado Annuity Settlements LIFE INSURANCE CO LINCOLN LOW CREDIT LINE CREDIT CARDS online colledges Hard drive Data Recovery Services Nunavut culture World Trade Center Footage holland michigan college pharmacist jobs in chicago car insurance companies Cheap Domain Registration Hosting Donating a Car in Maryland Criminal Defense Attorneys Florida miami personal injury attorney ONLINE MOTOR INSURANCE QUOTES mesothelioma law suits ashely madis Life Insurance Co Lincoln Auto Mobile Insurance Quote Best criminal lawyer in Arizona Online Colleges Online Classes Massage School Dallas Texas VIRTUAL DATA ROOMS wisconsin mesothelioma attorney Donate Old Cars to Charity motorcycle lawyer los angeles Low Credit Line Credit Cards buy gift card structured settlements annuities Donate your Car for Money Cheap Auto Insurance in VA Met Auto PHD on Counseling Education Donating used cars to charity Home Phone Internet Bundle ROYALTY FREE IMAGES STOCK dallas mesothelioma attorneys Forensics online course mesothelioma suit Car Insurance Quotes PA structured settlement company california mesothelioma attorney Royalty Free Images Stock mesothelioma charities Email Bulk Service Insurance Companies Insurance accident attorney orange county Donate cars Illinois personal injury lawyer Register Free Domains Better Conference Calls Mortgage Adviser injury lawyer houston tx domains yahoo city college in miami DONATE CARS IN MA Virtual Data Rooms best mesothelioma lawyers CAR INSURANCE QUOTES MN Auto Accident Attorney Data Recovery Raid la personal injury lawyer Motor Insurance Quotes

No hay comentarios:

Publicar un comentario