Skip to content

Commit 9c40bb8

Browse files
committed
graphs init
1 parent b43d1d4 commit 9c40bb8

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

25. Graph/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,47 @@
11
# Graph
2+
3+
Graphs are used in many social networks, any time users are modelled, recommendation engines, or advertisements based off on data, graphs are used.
4+
5+
## What is a Graph
6+
7+
> [A graph data structure consists of a finite (and possibly mutable) set of vertices (also called nodes or points), together with a set of unordered pairs of these vertices for an undirected graph or a set of ordered pairs for a directed graph. These pairs are known as edges (also called links or lines), and for a directed graph are also known as arrows. The vertices may be part of the graph structure, or may be external entities represented by integer indices or references](https://en.wikipedia.org/wiki/Graph_(abstract_data_type)).
8+
9+
**What?**
10+
11+
In simpler terms, a graph is a collection of nodes. A set of nodes together with a set of pairs of these vertices.
12+
13+
![graph](https://i.imgur.com/pCyYDFD.png "Graph")
14+
15+
Graphs are used in social networks, locations and mapping (GPS), routing algorithms, visual hierarchy, file system optimizations, **everywhere**.
16+
17+
For example, recommendation engines where any of the following are displayed:
18+
19+
- "People also watched"
20+
- "You might also like..."
21+
- "People you might know"
22+
- "Frequently bought with"
23+
24+
Graphs are used for data that needs to be highly connected.
25+
26+
## Graph terms
27+
28+
- **Vertex**: A node.
29+
- **Edge**: Connection between nodes.
30+
- **Weighted/Unweighted**: Values assigned to distances between vertices.
31+
- **Directed/Undirected**: Directions assigned to distanced between vertices.
32+
33+
A tree is a graph in which any two vertices are connected from any one path. Meaning that to go from, for example, *vertex A* to *vertex B* there's only *one path*. Contrast that to a graph as shown in the illustration above, to go from D to E, there are multiple paths.
34+
35+
### Undirected and Directed Graphs
36+
37+
Undirected Graphs feature no directions associated to the edges. That's useful depending on your modeling. Facebook, for example, requires users to accept each other in order to become friends, so that content can be shared between them. So in a directed graph, the direction of the edge will dictate if the users can see other's content, whether it is one directional or not.
38+
39+
## Wighted or Unweighted Graphs
40+
41+
In maps, edges (directions) between vertices (locations) have weights (distances) which are used to calculate distances between each vertices. Some edges might also have describe directions with one way streets, which would affect the calculations.
42+
43+
## Compare and contrast of different types of graphs and their use cases in the real world
44+
45+
## Graph traversal using BFS and DFS
46+
47+
## Compare and contrast graph traversal algorithms

0 commit comments

Comments
 (0)