



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to the data structure of graphs, focusing on vertices, edges, and adjacency lists. Graphs are a way to represent connections between objects, with vertices representing nodes and edges representing links. the basics of vertices and edges, as well as the two common ways to represent graph structures: adjacency matrices and adjacency lists. Real-world applications of graphs include computer science, social networks, and web page ranking.
Typology: Schemes and Mind Maps
1 / 6
This page cannot be seen from the preview
Don't miss anything!




package graph; class Edge { int src, dest, weight; Edge(int src, int dest, int weight) { this.src = src; this.dest = dest; this.weight = weight; } }
package graph; import java.util.ArrayList; import java.util.List; class Graph { // node of adjacency list static class Node { int value, weight; Node(int value, int weight) { this.value = value; this.weight = weight; } }; // define adjacency list List<List
" (" + edge.weight + ")\t"); } System. out .println(); src_vertex++; } } }