AI Generated Answers. The questions come from this blog’s graph-mining posts and are attributed to Sayed Ahmed. New AI-generated answers, examples and original illustrations are offered for reuse without copyright restrictions asserted by this blog. External resources retain their own licenses; verify technical details.
Course index: Graph Mining – 1. Original question sources: Original post and repost. This part answers questions 02.01 through 02.24.
Conventions: Unless stated otherwise, graphs are simple with no self-loops; V is the vertex count, E is the edge count, and adjacency lists are outgoing-neighbor lists for directed graphs.

Q02.01. What is a Graph?
Answer. A graph is a set of vertices and edges, conventionally G=(V,E). Edges can be directed, weighted, labeled, repeated, or time-dependent depending on the model.
Q02.02. Give an example of a Graph?
Answer. Example: V={A,B,C} with undirected edges {A,B} and {B,C}. A-B-C is a path; A and C are not directly adjacent.
Q02.03. What are the different Types of Graphs? i.e. Try to give some examples of different ways how Graphs are classified?
Answer. Common classifications include directed/undirected, simple/multigraph, weighted/unweighted, labeled/unlabeled, bipartite, signed/unsigned, connected/disconnected, and static/temporal. A tree is a specialized undirected graph.
Q02.04. What is a directed Graph?
Answer. In a directed graph (digraph), every edge is an ordered pair (u,v) representing u→v. A follows B does not imply B follows A.
Q02.05. What is an undirected Graph?
Answer. In an undirected graph, the edge {u,v} has no direction. It connects u and v symmetrically; a mutual friendship can be modeled this way.
Q02.06. What are Labeled Graphs?
Answer. A labeled graph attaches identifiers or types to vertices and/or edges. Example: vertices labeled Person, Company; edges labeled WORKS_FOR or KNOWS. Labels may describe category, not numerical weight.
Q02.07. What are Weighted Graphs?
Answer. A weighted graph assigns a value to each edge, such as distance, capacity, cost, or frequency. In a route graph, w(A,B)=5 km. A weight’s meaning matters: a high number can mean stronger similarity or higher travel cost.
Q02.08. What are the unweighted Graphs?
Answer. An unweighted graph treats each edge as present or absent; equivalently, all existing edges can have unit cost for hop-count shortest paths. This does not mean edge attributes are always absent.
Q02.09. What are the Bipartite Graphs?
Answer. A bipartite graph has disjoint vertex sets U and W, with edges only between the sets. Example: students and courses, connected by enrolment. There are no student-to-student or course-to-course edges in that bipartite representation.
Q02.10. What is a Tree?
Answer. A tree is a connected, cycle-free undirected graph. With n≥1 vertices it has exactly n−1 edges and a unique simple path between each pair. Directed rooted trees add an orientation and root.
Q02.11. What is a Signed Graph?
Answer. In a signed graph, edges carry a positive/negative sign, such as trust/distrust or activating/inhibiting interactions. A sign is not necessarily the same as a numerical weighted edge.
Q02.12. What is a Looped Graph? i.e. What is a loop?
Answer. A self-loop is an edge from a vertex back to itself, (u,u). In an undirected degree convention it contributes two to degree; in a digraph it contributes one in-edge and one out-edge.
Q02.13. Compare Static and Time-evolving Graphs.
Answer. A static graph is a single snapshot. A time-evolving graph has changing vertices, edges, weights, or properties. For example, employee collaboration on Monday may differ from Friday; analyze timestamps or snapshots to track that change.
Q02.14. What is an Isomorphic Graph?
Answer. Two graphs are isomorphic when there is a one-to-one correspondence between their vertices that preserves adjacency (and labels/weights/directions if those are part of the definition). Their drawings may look different while representing the same structure.
Q02.15. What does Isomorphism mean when it comes to Graphs?
Answer. Graph isomorphism means that vertex names and drawing positions do not matter to the core connection pattern. A triangle labeled A-B-C is structurally the same as a triangle labeled 4-5-6 under a suitable relabeling.
Q02.16. What are different ways to represent Graphs? i.e. when implementing Graph Algorithms?
Answer. Common representations: edge lists; adjacency matrices; adjacency lists/maps; incidence matrices; coordinate sparse matrices; and property-graph/graph-database structures. Time/layered graphs can use a sequence of snapshots or a higher-dimensional tensor.
Q02.17. How to store a Graph data in programming languages?
Answer. In Python use dict[str,set[str]] for neighbors, a list of edge tuples, a NumPy/SciPy matrix for numerical computation, or NetworkX for convenience. Very large graphs may use compressed sparse row (CSR) arrays or a graph database.
Q02.18. Describe the Adjacency Matrix approach of Graph Representation.
Answer. For V vertices, an adjacency matrix is a V×V array A. With row-as-source convention, A[i][j]=1 when edge i→j exists, otherwise 0. In a simple undirected graph A is symmetric and its diagonal is zero.
Q02.19. Give a small example graph then represent it using the Adjacency Matrix approach of Graph Representation.
Answer. Take undirected vertices A, B, C and edges A–B and B–C. With order (A,B,C), the matrix rows are [0,1,0], [1,0,1], [0,1,0]. Read row B as its neighbors.
Q02.20. Represent the following Graph using Adjacency Matrix approach of Graph Representation Edges: {0, 1} {0, 4} {1, 2} {1, 3} {1, 4} {2, 3} {3, 4}
Answer. For vertex order (0,1,2,3,4), the symmetric adjacency-matrix rows are:0: 0 1 0 0 11: 1 0 1 1 12: 0 1 0 1 03: 0 1 1 0 14: 1 1 0 1 0.
Each specified undirected edge appears twice, at A[i,j] and A[j,i].
Q02.21. What are the advantages/pros of the Adjacency Matrix Representation?
Answer. An adjacency matrix offers O(1) edge-existence checks, O(1) insertion/deletion when the vertex set is fixed, simple matrix algebra, and natural dense-graph representations. It can be convenient for GPUs and spectral methods.
Q02.22. What are the disadvantages/cons of the Adjacency Matrix Representation?
Answer. It requires Θ(V²) space even for a sparse graph. Enumerating one vertex’s neighbors scans V entries; adding a vertex can require resizing/reallocation. The all-zero value cannot distinguish absent from a legitimate zero-weight edge unless a separate mask/sentinel is used.
Q02.23. Describe the Adjacency List approach of Graph Representation.
Answer. An adjacency list maps each vertex to its adjacent vertices (optionally with edge weights). For undirected edges, record both endpoints; for a directed edge u→v, record v in u’s out-neighbor list.
Q02.24. Give a small example graph then represent it using the Adjacency List approach of Graph Representation.
Answer. Example undirected graph A–B–C is A:[B], B:[A,C], C:[B]. In a directed graph A→B→C, outgoing adjacency is A:[B], B:[C], C:[].
# Adjacency-list representation (undirected)
G = {0: {1,4}, 1: {0,2,3,4}, 2: {1,3},
3: {1,2,4}, 4: {0,1,3}}
assert sum(len(neighbors) for neighbors in G.values()) == 14
# 7 edges, stored twice = 14 neighbor entries
