Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Mathematics Articles
Page 2 of 21
Representation of Graphs
There are mainly two ways to represent a graph in computer science − Adjacency Matrix − A 2D array showing connections between vertices. Adjacency List − An array of linked lists showing neighbors of each vertex. Adjacency Matrix An adjacency matrix A[V][V] is a 2D array of size V × V where V is the number of vertices. For an undirected graph, if there is an edge between Vx and Vy, then A[Vx][Vy] = 1 and A[Vy][Vx] = 1 (the matrix is symmetric). For a directed graph, if there is an edge from Vx to ...
Read MoreRelations of a Set
A relation describes a connection or association between elements of sets. Relations may exist between objects of the same set or between objects of two or more sets. Definition and Properties A binary relation R from set X to set Y (written as xRy or R(x, y)) is a subset of the Cartesian product X × Y. Each element of R is an ordered pair (x, y) where x ∈ X and y ∈ Y. More generally, an n-ary relation R between sets A1, A2, ..., An is a subset of the Cartesian product A1 × A2 ...
Read MoreThe Predicate Calculus
Predicate Calculus (also called first-order logic) extends propositional logic by dealing with predicates − statements that contain variables. While propositional logic works with fixed true/false statements, predicate calculus allows us to express properties of objects and relationships between them. Predicate A predicate is an expression of one or more variables defined on some specific domain. A predicate with variables can be made a proposition by either assigning a value to the variable or by quantifying the variable. Consider the statement − "Ram is a student." "is a student" is the predicate (P), and "Ram" is ...
Read MorePower Set
The power set of a set S is the set of all subsets of S, including the empty set and S itself. The power set is denoted as P(S). If S has n elements, then its power set has 2n elements. Example For a set S = { a, b, c, d }, let us list all the subsets grouped by size − Subsets with 0 elements: { ∅ } Subsets with 1 element: { a }, { b }, { c }, { d } Subsets with 2 elements: { a, ...
Read MoreIndependent Vertex Set
An independent vertex set of a graph G is a subset of vertices where no two vertices are adjacent (connected by an edge). This concept is the vertex counterpart of the independent line set (matching), and is fundamental to problems like graph coloring and vertex cover. Independent Vertex Set Let G = (V, E) be a graph. A subset S of V is called an independent vertex set of G if no two vertices in S are adjacent − that is, no edge in G connects any pair of vertices in S. Example ...
Read MoreIndependent Line Set
An independent set in a graph is a set of elements (vertices or edges) where no two elements are adjacent to each other. There are two types − Independent line set (edge independent set) − A set of edges where no two edges share a common vertex. Independent vertex set − A set of vertices where no two vertices share a common edge. Independent Line Set Let G = (V, E) be a graph. A subset L of E is called an independent line set (also called a matching) if no two edges in L ...
Read MoreBipartite Graphs
A bipartite graph is a graph whose vertex set can be split into two disjoint sets, V1 and V2, such that every edge connects a vertex in V1 to a vertex in V2. No edge connects two vertices within the same set. Bipartite Graph If the vertex-set of a graph G can be split into two disjoint sets V1 and V2, in such a way that each edge joins a vertex in V1 to a vertex in V2, and there are no edges connecting two vertices within V1 or within V2, then G is called a bipartite graph. ...
Read MoreCenters of a tree
The center of a tree is a vertex with minimal eccentricity. The eccentricity of a vertex X in a tree G is the maximum distance between vertex X and any other vertex of the tree. The maximum eccentricity across all vertices is the diameter of the tree. If a tree has exactly one center, it is called a central tree. If a tree has exactly two centers (connected by an edge), it is called a bi-central tree. Every tree is either central or bi-central. Algorithm to Find Centers of a Tree The algorithm works ...
Read MoreCircuit Rank
The circuit rank (also called the cycle rank or cyclomatic number) of a connected graph tells you how many edges must be removed to eliminate all cycles and produce a spanning tree. Let G be a connected graph with n vertices and m edges. A spanning tree of G contains exactly (n − 1) edges. Therefore, the number of edges you need to delete from G to get a spanning tree is − Circuit Rank = m − (n − 1) This formula works because a spanning tree must have exactly n − 1 edges. ...
Read MoreComplement of Graph
The article is already well-structured. I'll replace the JPG image with an SVG diagram showing the graph and its complement side by side. The complement of a graph G, denoted as G̅, is a simple graph with the same set of vertices as G. An edge {U, V} exists in G̅ if and only if that edge is not present in G. In other words, two vertices are adjacent in G̅ if and only if they are not adjacent in G. If the edges that exist in graph I are absent in graph II, and combining both graphs ...
Read More