MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / main

Method main

Programs/BellmanFord.java:74–106  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

72 }
73
74 public static void main(String[] args) {
75 int V = 5; // Total vertices
76 int E = 8; // Total Edges
77
78 CreateGraph graph = new CreateGraph(V, E);
79
80 // edge 0 --> 1
81 graph.edge[0].s = 0;
82 graph.edge[0].d = 1;
83 graph.edge[0].w = 5;
84
85 // edge 0 --> 2
86 graph.edge[1].s = 0;
87 graph.edge[1].d = 2;
88 graph.edge[1].w = 4;
89
90 // edge 1 --> 3
91 graph.edge[2].s = 1;
92 graph.edge[2].d = 3;
93 graph.edge[2].w = 3;
94
95 // edge 2 --> 1
96 graph.edge[3].s = 2;
97 graph.edge[3].d = 1;
98 graph.edge[3].w = 6;
99
100 // edge 3 --> 2
101 graph.edge[4].s = 3;
102 graph.edge[4].d = 2;
103 graph.edge[4].w = 2;
104
105 graph.BellmanFord(graph, 0); // 0 is the source vertex
106 }
107}

Callers

nothing calls this directly

Calls 1

BellmanFordMethod · 0.95

Tested by

no test coverage detected