Graphs Flashcards
(11 cards)
Types of “graphs”
Undirected graphs
The edges between any two vertices in an “undirected graph” do not have a direction, indicating a two-way relationship.
Directed graphs
The edges between any two vertices in a “directed graph” graph are directional.
Weighted graphs
Each edge in a “weighted graph” has an associated weight. The weight can be of any metric, such as time, distance, size, etc.
The Definition of “graph”
“Graph” is a non-linear data structure consisting of vertices and edges.
Vertex
nodes such as A, B, and C are called vertices of the graph.
Edge
The connection between two vertices are the edges of the graph.
Path
the sequence of vertices to go through from one vertex to another.
Path Length
the number of edges in a path
Cycle
a path where the starting point and endpoint are the same vertex
Negative Weight Cycle
In a “weighted graph”, if the sum of the weights of all edges of a cycle is a negative value, it is a negative weight cycle
Connectivity
if there exists at least one path between two vertices, these two vertices are connected
Degree of a Vertex
the term “degree” applies to unweighted graphs. The degree of a vertex is the number of edges connecting the vertex
In-Degree
“in-degree” is a concept in directed graphs. If the in-degree of a vertex is d, there are d directional edges incident to the vertex.