Graphs
non-linear data structure that can be looked at as a collection of vertices (or nodes) potentially connected by line segments named edges.
Terminology
- Vertex : also called a “node”, a data object that can have zero or more adjacent vertices.
- Edge : a connection between two nodes.
- Neighbor : The neighbors of a node are its adjacent nodes.
- Degree : the number of edges connected to that vertex.
Undirected Graphs
Undirected Graph is a graph where each edge is undirected or bi-directional. This means that the undirected graph does not move in any direction.
Directed Graphs (Digraph)
A Directed Graph also called a Digraph is a graph where every edge is directed.
Complete vs Connected vs Disconnected
- Complete Graphs: when all nodes are connected to all other nodes.
- Connected: has all of vertices/nodes have at least one edge.
- Disconnected: when some vertices may not have edges.
Acyclic vs Cyclic
cycle: is when a node can be traversed through and potentially end up back at itself.
- Acyclic Graph: a directed graph without cycles.
- Cyclic Graphs: is a graph that has cycles.
Weighted Graphs
A weighted graph is a graph with numbers assigned to its edges. These numbers are called weights.
examples of graphs in use:
- GPS and Mapping
- Driving Directions
- Social Networks
- Airline Traffic
- Netflix uses graphs for suggestions of products
Get back to EMAM’S HOMEPAGE
I have created this page as a part of my project using Github, Please visit my profile, I will be more than happy to hear from you all. © Emam Shararah 2021