SlideShare a Scribd company logo
Hi All!
I have a question regrading creating a subgraph or rather verifying that a connected or
unconnected graph has a connected or unconnected subgraph. I have a territory object, and each
of these objects have adjacent territories in the form of a string vector. Moreover, these territory
objects also have strin continent attached (every territory belongs to one and only one continent).
Is there a way in C++ to check to see if the contients for a connected subgraph? This is the code
I currently have running to check to see if that graph is connected, I wanted to know if there was
a way to check if the subgraphs are connected.
//walk function will traverse the map. This will be a recursive function to walk along the array
void Map::walk(int visit, bool visited[]){
visited[visit] = true;
for(int i = 0; i< vertCount; i++){
if(adjacencyMatrix[visit][i] == 1){
if(!visited[visit]){
walk(i, visited);
}
}
}
}
//verify if an edge is connected in a graph
bool Map::validate(){
bool connectedGraph=false;
bool connectedSubGraph=false;
bool notUniqueContinent = true;
bool* verifyArr = new bool[vertCount];
//the idea here is we will start at i=o, then traverse and check as we go along whether or not all
nodes are visble
for(int i=0; i

More Related Content

More from mail931892 (6)

PDF
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
mail931892
 
PDF
how can i build this as problem 2 of my code #include iostream.pdf
mail931892
 
PDF
HeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdf
mail931892
 
PDF
Help I keep getting the same error when running a code. Below is the.pdf
mail931892
 
PDF
For this part you will need to analyze the provided logfile part2.lo.pdf
mail931892
 
PDF
Ginny (45) is unmarried. Who of the following may be Ginnys quali.pdf
mail931892
 
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
mail931892
 
how can i build this as problem 2 of my code #include iostream.pdf
mail931892
 
HeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdf
mail931892
 
Help I keep getting the same error when running a code. Below is the.pdf
mail931892
 
For this part you will need to analyze the provided logfile part2.lo.pdf
mail931892
 
Ginny (45) is unmarried. Who of the following may be Ginnys quali.pdf
mail931892
 

Recently uploaded (20)

PDF
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
PPTX
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
PPTX
Light Reflection and Refraction- Activities - Class X Science
SONU ACADEMY
 
PPTX
Lesson 1 Cell (Structures, Functions, and Theory).pptx
marvinnbustamante1
 
PPTX
Life and Career Skills Lesson 2.pptxProtective and Risk Factors of Late Adole...
ryangabrielcatalon40
 
PPTX
AIMA UCSC-SV Leadership_in_the_AI_era 20250628 v16.pptx
home
 
PDF
Indian National movement PPT by Simanchala Sarab, Covering The INC(Formation,...
Simanchala Sarab, BABed(ITEP Secondary stage) in History student at GNDU Amritsar
 
PDF
Lesson 1 - Nature of Inquiry and Research.pdf
marvinnbustamante1
 
PPTX
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
PPT
Indian Contract Act 1872, Business Law #MBA #BBA #BCOM
priyasinghy107
 
PDF
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
PPTX
Introduction to Indian Writing in English
Trushali Dodiya
 
PPTX
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
PDF
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
PDF
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
PDF
Our Guide to the July 2025 USPS® Rate Change
Postal Advocate Inc.
 
PDF
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
PDF
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
PPTX
How to Manage Expiry Date in Odoo 18 Inventory
Celine George
 
PPTX
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
Light Reflection and Refraction- Activities - Class X Science
SONU ACADEMY
 
Lesson 1 Cell (Structures, Functions, and Theory).pptx
marvinnbustamante1
 
Life and Career Skills Lesson 2.pptxProtective and Risk Factors of Late Adole...
ryangabrielcatalon40
 
AIMA UCSC-SV Leadership_in_the_AI_era 20250628 v16.pptx
home
 
Indian National movement PPT by Simanchala Sarab, Covering The INC(Formation,...
Simanchala Sarab, BABed(ITEP Secondary stage) in History student at GNDU Amritsar
 
Lesson 1 - Nature of Inquiry and Research.pdf
marvinnbustamante1
 
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
Indian Contract Act 1872, Business Law #MBA #BBA #BCOM
priyasinghy107
 
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
Introduction to Indian Writing in English
Trushali Dodiya
 
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
Our Guide to the July 2025 USPS® Rate Change
Postal Advocate Inc.
 
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
How to Manage Expiry Date in Odoo 18 Inventory
Celine George
 
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 

Hi All!I have a question regrading creating a subgraph or rather v.pdf

  • 1. Hi All! I have a question regrading creating a subgraph or rather verifying that a connected or unconnected graph has a connected or unconnected subgraph. I have a territory object, and each of these objects have adjacent territories in the form of a string vector. Moreover, these territory objects also have strin continent attached (every territory belongs to one and only one continent). Is there a way in C++ to check to see if the contients for a connected subgraph? This is the code I currently have running to check to see if that graph is connected, I wanted to know if there was a way to check if the subgraphs are connected. //walk function will traverse the map. This will be a recursive function to walk along the array void Map::walk(int visit, bool visited[]){ visited[visit] = true; for(int i = 0; i< vertCount; i++){ if(adjacencyMatrix[visit][i] == 1){ if(!visited[visit]){ walk(i, visited); } } } } //verify if an edge is connected in a graph bool Map::validate(){ bool connectedGraph=false; bool connectedSubGraph=false; bool notUniqueContinent = true; bool* verifyArr = new bool[vertCount]; //the idea here is we will start at i=o, then traverse and check as we go along whether or not all nodes are visble for(int i=0; i