Skip to content

Commit 5393038

Browse files
committed
graph terminology
1 parent dec910c commit 5393038

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,12 @@
126126
- [x] [Sort HashMap by value](https://www.digitalocean.com/community/tutorials/java-programming-interview-questions#24-write-a-java-program-that-sorts-hashmap-by-value)
127127

128128
### Graphs
129+
- [x] [Terminology and Representations of Graphs](http://www.techiedelight.com/terminology-and-representations-of-graphs/)
129130
- [x] Given a list of edges and tasked to build your own graph from the edges
130131
### Matrix
131132

132133
### Trees
133-
- [ ] [Same Tree](https://leetcode.com/problems/same-tree/)
134+
- [x] [Same Tree](https://leetcode.com/problems/same-tree/)
134135
- [x] [Subtree of Another Tree](https://leetcode.com/problems/subtree-of-another-tree/)
135136
### Heaps
136137

@@ -281,7 +282,6 @@
281282
- [ ] [Graph Valid Tree](https://leetcode.com/problems/graph-valid-tree/)
282283
- [ ] [Number of Connected Components in an Undirected Graph](https://leetcode.com/problems/graph-valid-tree/)
283284
- [ ] [Longest Consecutive Sequence](https://leetcode.com/problems/longest-consecutive-sequence/)
284-
- [ ] [Terminology and Representations of Graphs](http://www.techiedelight.com/terminology-and-representations-of-graphs/)
285285
- [ ] [Graph Implementation using STL](http://www.techiedelight.com/graph-implementation-using-stl/)
286286
- [ ] [Graph Implementation in C++ without using STL](http://www.techiedelight.com/graph-implementation-c-without-using-stl/)
287287
- [ ] [Arrival and Departure Time of Vertices in DFS](http://www.techiedelight.com/arrival-departure-time-vertices-dfs/)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Graphs
2+
3+
1. What is a Graph?
4+
> A graph is an ordered pair G = (V, E) comprising a set V of vertices or nodes and a collection of pairs of vertices from V, known as edges of a graph. For example, for the graph below.
5+
> V = { 1, 2, 3, 4, 5, 6 }E = { (1, 4), (1, 6), (2, 6), (4, 5), (5, 6) }
6+
7+
2. What Types of Graph are there?
8+
> 1. Undirected graph (edges have no orientation - edges are not ordered pairs. The maximum number of edges possible in an undirected graph without a loop is n×(n-1)/2.)
9+
> 2. Directed graph (edges have orientations, i.e., The edge (x, y) is not identical to edge (y, x).)
10+
> 3. Directed Acyclic Graph (DAG) (A Directed Acyclic Graph (DAG) is a directed graph that contains no cycles.)
11+
> 4. Multi graph (an undirected graph in which multiple edges (and sometimes loops) are allowed. Multiple edges are two or more edges that connect the same two vertices. A loop is an edge (directed or undirected) that connects a vertex to itself; it may be permitted or not.)
12+
> 5. Simple graph (an undirected graph in which both multiple edges and loops are disallowed as opposed to a multigraph. In a simple graph with n vertices, every vertex’s degree is at most n-1.)
13+
> 6. Weighted Graph (associates a value (weight) with every edge in the graph. We can also use words cost or length instead of weight.) - unweighted by default (aka weight = 1 everywhere)
14+
> 7. Complete graph (A complete graph is one in which every two vertices are adjacent: all edges that could exist are present.)
15+
> 8. Connected graph (has a path between every pair of vertices. In other words, there are no unreachable vertices. A disconnected graph is a graph that is not connected.)
16+
17+
[Further reading](https://www.techiedelight.com/terminology-and-representations-of-graphs/)
18+
19+
20+
21+
22+
23+
24+
25+
26+

0 commit comments

Comments
 (0)