Created
May 18, 2020 09:21
-
-
Save AmirBikchentaev/d35b481fb5301f42c120a975d9129cfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void searchForArtPoints() | |
{ | |
int initialComponents = this.searhchForConnectivityComponents(-1); | |
for (int i = 0; i < graph.Count(); i++) | |
{ | |
for (int k = 0; k < graph.Count(); k++) | |
{ | |
visitedVerticesConComp[k] = false; | |
} | |
int currentComponent = this.searhchForConnectivityComponents(i); | |
if (currentComponent > initialComponents) | |
{ | |
Console.WriteLine("articulation points is"+ currentComponent); | |
} | |
} | |
} | |
public int searhchForConnectivityComponents(int verticeNotTogo) | |
{ | |
int connectivityComponentsCounter = 0; | |
for (int i = 0; i < graph.Count(); i++) | |
{ | |
if (visitedVerticesConComp[i] != true&&graph[i].Count!=0 && i!= verticeNotTogo) | |
{ | |
DFSforConnComp(i,verticeNotTogo); | |
Console.WriteLine(); | |
connectivityComponentsCounter++; | |
Console.WriteLine("the amount of "+connectivityComponentsCounter); | |
return connectivityComponentsCounter; | |
} | |
} | |
Console.WriteLine("the amount of " + connectivityComponentsCounter); | |
return connectivityComponentsCounter; | |
} | |
public void DFSforConnComp(int vertex,int verticeNotToGO) | |
{ | |
visitedVerticesConComp[vertex] = true; | |
for (int i = 0; i < graph[vertex].Count(); i++) | |
{ | |
if (!visitedVerticesConComp[graph[vertex][i]]&& graph[vertex][i]!= verticeNotToGO) | |
{ | |
Console.Write(graph[vertex][i]); | |
DFSforConnComp(graph[vertex][i],verticeNotToGO); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment