-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.java
More file actions
24 lines (19 loc) · 1.87 KB
/
Copy pathGraph.java
File metadata and controls
24 lines (19 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Graph
// A graph is a collection of vertices and edges. Each edge connects two vertices and may have a weight associated with it. Graphs can be directed or undirected, depending on whether the edges have a direction or not.
// Types of Graphs:
// 1. Directed Graph (Digraph): In a directed graph, edges have a direction
// 2. Undirected Graph: In an undirected graph, edges do not have a direction
// 3. Weighted Graph: In a weighted graph, edges have weights associated with them
// 4. Unweighted Graph: In an unweighted graph, edges do not have weights
// 5. Cyclic Graph: A graph that contains at least one cycle
// 6. Acyclic Graph: A graph that does not contain any cycles
// 7. Connected Graph: A graph where there is a path between every pair of vertices
// 8. Disconnected Graph: A graph where there is at least one pair of vertices that does not have a path between them
// 9. Complete Graph: A graph where there is an edge between every pair of vertices
// 10. Bipartite Graph: A graph whose vertices can be divided into two disjoint sets such that every edge connects a vertex in one set to a vertex in the other set
// 11. Eulerian Graph: A graph whose each node has an even degree, allowing for a path that visits every edge exactly once (Eulerian circuit) or a path that visits every edge exactly once but starts and ends at different vertices (Eulerian path)
// 12. Hamiltonian Graph: A graph that contains a Hamiltonian cycle (a cycle that visits every vertex exactly once)
// Graph Representation:
// 1. Adjacency Matrix: A 2D array where the value at row i and column j indicates the presence (and possibly weight) of an edge from vertex i to vertex j.
// 2. Adjacency List: A list where each vertex has a list of adjacent vertices (and possibly weights).
// 3. Edge List: A list of all edges in the graph, where each edge is represented as a pair of vertices (and possibly weight).