Isomorphism in Mathematics and Computer Science

Mahesh Parahar
Updated on 23-Aug-2019 11:31:41

868 Views

A graph can exist in different forms having the same number of vertices, edges, and also the same edge connectivity. Such graphs are called isomorphic graphs. Note that we label the graphs in this chapter mainly for the purpose of referring to them and recognizing them from one another.Isomorphic GraphsTwo graphs G1 and G2 are said to be isomorphic if −Their number of components (vertices and edges) are same.Their edge connectivity is retained.Note − In short, out of the two isomorphic graphs, one is a tweaked version of the other. An unlabelled graph also can be thought of as an ... Read More

Change Data Type for One or More Columns in Pandas DataFrame

Pradeep Elance
Updated on 23-Aug-2019 11:30:14

2K+ Views

Many times we may need to convert the data types of one or more columns in a pandas data frame to accommodate certain needs of calculations. There are some in-built functions or methods available in pandas which can achieve this.Using astype()The astype() method we can impose a new data type to an existing column or all columns of a pandas data frame. In the below example we convert all the existing columns to string data type.Example Live Demoimport pandas as pd #Sample dataframe df = pd.DataFrame({    'DayNo': [1, 2, 3, 4, 5, 6, 7],    'Name': ['Sun', 'Mon', 'Tue', 'Wed', ... Read More

Count Occurrences of Integer in MySQL Column

AmitDiwan
Updated on 23-Aug-2019 11:27:21

306 Views

For this, use aggregate function COUNT(). Let us first create a table −mysql> create table DemoTable650 (Value1 int, Value2 int); Query OK, 0 rows affected (0.83 sec)Insert some records in the table using insert command −mysql> insert into DemoTable650 values(100, 500); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable650 values(100, 500); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable650 values(100, 500); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable650 values(100, 500); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable650 values(200, 500); Query OK, 1 row affected (0.12 sec)Display ... Read More

Definition and Properties of Trees

Mahesh Parahar
Updated on 23-Aug-2019 11:24:23

17K+ Views

Tree is a discrete structure that represents hierarchical relationships between individual elements or nodes. A tree in which a parent has no more than two children is called a binary tree.Tree and its PropertiesDefinition − A Tree is a connected acyclic undirected graph. There is a unique path between every pair of vertices in G. A tree with N number of vertices contains (N-1) number of edges. The vertex which is of 0 degree is called root of the tree. The vertex which is of 1 degree is called leaf node of the tree and the degree of an internal ... Read More

Hamiltonian Graphs

Mahesh Parahar
Updated on 23-Aug-2019 11:20:48

16K+ Views

Hamiltonian graph - A connected graph G is called Hamiltonian graph if there is a cycle which includes every vertex of G and the cycle is called Hamiltonian cycle. Hamiltonian walk in graph G is a walk that passes through each vertex exactly once.Dirac's Theorem - If G is a simple graph with n vertices, where n ≥ 3 If deg(v) ≥ {n}/{2} for each vertex v, then the graph G is Hamiltonian graph.Ore's Theorem - If G is a simple graph with n vertices, where n ≥ 2 if deg(x) + deg(y) ≥ n for each pair of non-adjacent ... Read More

Types of Graph

Mahesh Parahar
Updated on 23-Aug-2019 11:18:14

1K+ Views

There are various types of graphs depending upon the number of vertices, number of edges, interconnectivity, and their overall structure. We will discuss only a certain few important types of graphs in this chapter.Null GraphA graph having no edges is called a Null Graph.ExampleIn the above graph, there are three vertices named 'a', 'b', and 'c', but there are no edges among them. Hence it is a Null Graph.Trivial GraphA graph with only one vertex is called a Trivial Graph.ExampleIn the above shown graph, there is only one vertex 'a' with no other edges. Hence it is a Trivial graph.Non-Directed ... Read More

Return a Specific MySQL String Using Regular Expressions

AmitDiwan
Updated on 23-Aug-2019 11:17:13

140 Views

Let us first create a table −mysql> create table DemoTable649 (Value text); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable649 values('1903'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable649 values('9321010'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable649 values('983032023393'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable649 values('1234567892'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable649 values('989898989'); Query OK, 1 row affected (0.20 sec)Display all records from the table using select statement −mysql> select *from DemoTable649;This will ... Read More

Inverse of Function of Set

Mahesh Parahar
Updated on 23-Aug-2019 11:16:09

541 Views

The inverse of a one-to-one corresponding function f: A → B, is the function g: B → A, holding the following property −f(x) = y ⇔ g(y) = xThe function f is called invertible if its inverse function g exists.ExampleA Function f : Z → Z, f(x)=x+5, is invertible since it has the inverse function g : Z → Z, g(x)= x-5.A Function f : Z → Z, f(x)=x2 is not invertiable since this is not one-to-one as (-x)2=x2.

Set Current Date and Time to Timestamp in MySQL

AmitDiwan
Updated on 23-Aug-2019 11:13:54

547 Views

Let us first create a table. One of the columns is set as TIMESTAMP −mysql> create table DemoTable648(    UserId int NOT NULL AUTO_INCREMENT, UserLoginTime TIMESTAMP NOT NULL    DEFAULT CURRENT_TIMESTAMP, PRIMARYKEY(UserId) ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command. Here, we have set the current date and time to timestamp column using the NOW() method −mysql> insert into DemoTable648(UserLoginTime) values(NOW()); Query OK, 1 row affected (0.22 sec)Display all records from the table using select statement −mysql> select *from DemoTable648;This will produce the following output −+--------+---------------------+ | UserId | UserLoginTime     ... Read More

Understanding Homomorphism

Mahesh Parahar
Updated on 23-Aug-2019 11:12:38

2K+ Views

Two graphs G1 and G2 are said to be homomorphic, if each of these graphs can be obtained from the same graph 'G' by dividing some edges of G with more vertices. Take a look at the following example −Divide the edge 'rs' into two edges by adding one vertex.The graphs shown below are homomorphic to the first graph.If G1 is isomorphic to G2, then G is homeomorphic to G2 but the converse need not be true.Any graph with 4 or less vertices is planar.Any graph with 8 or less edges is planar.A complete graph Kn is planar if and ... Read More

Advertisements