Photo by Shahadat Rahman on Unsplash

Member-only story

Hands-on Tutorial

How to Find Diameter of Graph Using SNAP (Stanford Network Analysis Project) Package

SNAP is a package for large network analysis and manipulation written in C++ which can boost the calculations

--

The network is a collection of vertices connected by edges with a certain context. Whereas the graph is having no context. Both network and graph have characteristics — length, distances between two vertices, radius, diameter, etc.

In this short tutorial, we will explore how to find the diameter in a graph faster using SNAP. Getting the path between two vertices is a problem and finding the shortest path is another problem. The right packages will efficiently cut off the running time to get the diameter.

Happy reading! Feliz lectura!

The diameter in a graph

The diameter is the longest path of the shortest path between two vertices in a network or graph. To clearly understand, look at the following graph. We have 5 vertices and 7 edges. What is the diameter of the graph? It must be 2.

When you choose a vertex— for instance, vertex A, it only needs a maximum of 2 edges to reach the furthest vertices (for instance, vertex E)…

--

--

Audhi Aprilliant
Audhi Aprilliant

Written by Audhi Aprilliant

Data Scientist. Tech Writer. Statistics, Data Analytics, and Computer Science Enthusiast. Portfolio & social media links at http://audhiaprilliant.github.io/

No responses yet