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


Donate old cars to charity sell annuity payment Casino reviews motor insurance quotes NEUSON mesothelioma survival rates Psd to WordPress CAR INSURANCE IN SOUTH DAKOTA MESOTHELIOMA LAW FIRM PSYCHIC FOR FREE att call conference Hire php developer best accident attorneys Cheap Domain Registration Hosting cheap auto insurance in va benchmark lending chicago hair laser removal email bulk service Online Criminal Justice Degree Mobile casino Donate Your Car Sacramento Dayton Freight Lines mesothelioma care Low Credit Line Credit Cards Online casino Casino accident car florida lawyer car insurance quotes mn Seo company miami personal injury attorney Custom WordPress theme designer Best social media platforms for business Adobe illustrator classes Online Colleges Virtual Data Rooms Custom Christmas cards Html email domains yahoo Criminal lawyer Donate Your Car for Kids washington mesothelioma attorney Bankruptcy lawyer Annuity Settlements NUNAVUT CULTURE motorcycle accident lawyer california meso lawyer mesothelioma lawyer virginia Social media platforms Service business software How to Donate A Car in California PhD in counseling education structured settlement purchasers Live casino Royalty free images stock Business management software Donate Car to Charity California Car Donate Make money online Australia Mortgage adviser auto insurance cost by state CHEAP AUTO INSURANCE IN VA Hard drive Data Recovery Services arizona auto accident attorney workers compensation lawyer los angeles Donate car for tax credit DUI lawyer Dwi lawyer phd in counseling education ONLINE MOTOR INSURANCE QUOTES Hire php developers mesothelioma settlements Php programmers for hire compare life assurance Business finance group criminal defense federal lawyer Hire php programmers Royalty Free Images Stock Psd to html PAPERPORT PROMOTIONAL CODE mesothelioma suit Seo services structured settlement quote Car Insurance Quotes Donating a car in Maryland Futuristic Architecture personal injury attorney springfield mo Criminal defense lawyer CAR INSURANCE QUOTES COLORADO asbestos lung cancer Cheap Auto Insurance in VA cheaper insurance companies Car insurance quotes Utah Computer science classes online Best Seo company Php programmers Insurance Companies virtual data rooms Seo companies Social media management Cheap Car Insurance in Virginia Data Recovery Raid New social media platforms verizon sip Car insurance quotes Colorado car accident lawyers los angeles royalty free images stock WordPress theme designers MOTOR REPLACEMENTS what is structured settlement Holland Michigan College city college in miami Forensics Online Course Social media platforms for business motorcycle accident lawyer san francisco injury lawyer houston tx event management security primary pulmonary hypertension mesotheloma Best social media platforms buy gift card LIFE INSURANCE CO LINCOLN Online Christmas cards DALLAS MESOTHELIOMA ATTORNEYS Photo Christmas cards WordPress themes for designers VIRTUAL DATA ROOMS Car Accident Lawyers motorcycle accident attorney sacramento accident attorney in los angeles online colledges WordPress hosting Car Insurance Quotes Utah Social media examiner cheap car insurance in virginia Webex Costs Tech school new mexico mesothelioma lawyer sell structured settlement calculator BEST CRIMINAL LAWYER IN ARIZONA Donate Cars Illinois SELL ANNUITY PAYMENT Psychic for Free Car insurance quotes MN Neuson mortgage adviser Paperport promotional code auto insurance yuba city ca low credit line credit cards Christmas cards Proud Italian cook DONATING A CAR IN MARYLAND selling my structured settlement domain registration yahoo Forex Trading Platform Italian cooking school california motorcycle accident lawyer refinance with bad credit how to donate a car in california better conferencing calls Social media strategies Mortgage Adviser houston tx auto insurance Learning adobe illustrator donating used cars to charity Social media tools Social media campaigns Business VOIP Solutions Mesothelioma Law Firm Donate Car for Tax Credit Motor Insurance Quotes Donate Cars in MA Paperport Promotional Code structured annuity settlement WEBEX COSTS Donating a Car in Maryland Sell Annuity Payment philadelphia mesothelioma lawyer Asbestos Lawyers Structures Annuity Settlement DONATE YOUR CAR FOR KIDS Car Insurance Quotes Colorado car insurance quotes pa mesothelioma symptoms Nunavut Culture Donate Car To Charity CALIFORNIA DONATE YOUR CAR FOR MONEY Donate a Car in Maryland structured settlement need cash now alabama mesothelioma lawyer dui lawyer scottsdale Motor Replacements MASSAGE SCHOOL DALLAS TEXAS CHEAP CAR INSURANCE IN VIRGINIA Criminal Defense Attorneys Florida Best Criminal Lawyers in Arizona Auto Mobile Shipping Quote los angeles motorcycle accident lawyer Life Insurance Co Lincoln Online Motor Insurance Quotes BETTER CONFERENCING CALLS fortis health insurance temporary st louis mesothelioma attorney emergency response plan ppt Online Classes holland michigan college Donate your Car for Money World Trade Center Footage Massage School Dallas Texas Donate Old Cars to Charity yahoo web hosting Cheap car insurance in Virginia asbestos exposure lawyers anti spam appliance Dallas Mesothelioma Attorneys Car Insurance Quotes MN Nunavut culture onlineclasses Home phone internet bundle ROYALTY FREE IMAGES STOCK florida car insurance company Met Auto Home Phone Internet Bundle Donating Used Cars to Charity PHD on Counseling Education Car Insurance Quotes PA Car Insurance in South Dakota car accident lawyer san bernardino Email Bulk Service mesothelioma lawyers san diego Cheap Car Insurance for Ladies Register Free Domains Better Conference Calls best criminal lawyer in arizona motorcycle lawyer los angeles mesothelioma attorney florida Online College Course Automobile Accident Attorney Auto Accident Attorney mesothelioma ct mesothelioma lawyer dallas Criminal lawyer Miami Personal Injury Lawyers Asbestos Lung Cancer mesothelioma law firm offshore accident lawyer Injury Lawyers Personal Injury Law Firm Motor replacements MET AUTO Car Insurance Companies

No hay comentarios:

Publicar un comentario