Skip to content

Commit 97fa59b

Browse files
authored
Created BridgeUsage.java
Illustrates the usage of Bridge class
1 parent 1f63336 commit 97fa59b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Bridge/BridgeUsage.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class BridgeUsage{
2+
//Usage Example Bridge.bridges()
3+
public static void bridgesUsage(){
4+
int N = 6, E = 6;
5+
int[] from = new int[]{0,1,1,2,2,4};
6+
int[] to = new int[]{5,4,5,3,4,5};
7+
8+
int[][][] graph = GraphBuilder.makeGraphWithEdgeInfo(N, E, from, to, true);
9+
boolean[] isBridge = Bridge.bridges(graph, E);
10+
11+
for(int i = 0; i< E; i++){
12+
if(isBridge[i])
13+
System.out.println(from[i] + " - " + to[i] + " is a bridge");
14+
}
15+
}
16+
17+
public static void main(String[] args){
18+
bridgesUsage();
19+
}
20+
}

0 commit comments

Comments
 (0)