Network Algorithms Assignment
Python program has been considered as a high level language for programming. Guido Van Rossum first developed this program in 1991 (Srnecet al., 2017). This program has an appropriate design of philosophy which directly emphasizes the readability of code and syntax in order to allow the programmers to express their overall concepts in lesser data of codes rather it makes an effective use of significant whitespaces. This leads the programmer to develop a clear programming on both large and small scales. Interpreters of python are available for numerous operating systems like, Python, reference implementation of Python, which refers to an open source software in the model of community-based development. Core philosophy of the language Python is overall summarized within the document of Zen of Pythonthat consist of aphorisms. The language of Python was designed as highly extensible, which was one of the major reason behind its popularity as it had compact modularity by means of programmable interfaces within the existing applications. Programmers of Python had mainly focused to design it in such manner that would enable the users to have fun while using it. Python developers also strived to avoid optimization of premature and thereby, lead in rejecting patches to the non-critical terms of CPython that offered multiple marginal lines in increasing the speed for the cost of clarity.
Uses of python program for checking isomorphism
Isomorphism is the scenario in which two algorithm strings are identical in characters and connections. Python program is used for identifying, and testing of two algorithm trees are identical or not. The python program analyses the occurrences of every characteristic of one algorithm with the another. This similarity between two algorithm trees is tested by mapping out one character of an algorithm ........
Uses of python program for checking isomorphism
Isomorphism is the scenario in which two algorithm strings are identical in characters and connections. Python program is used for identifying, and testing of two algorithm trees are identical or not. The python program analyses the occurrences of every characteristic of one algorithm with the another. This similarity between two algorithm trees is tested by mapping out one character of an algorithm with that of the second algorithm tree.
For example, in case first algorithm tree is named as str1 and the other algorithm tree which is isomorphic is named as str2, then in the following manner it is tested;
Input: str1 = "aab", str2 = "xxy"
'a' is mapped to 'x', and 'b' is mapped to 'y'.
Input: str1 = "aab", str2 = "xyz"
One occurrence of 'a' in str1 has 'x' in str2 and
other occurrence of 'a' has 'y'.
# Node of a Binary tree
# Constructor for creating a node of Binary tree
def __init__(self, data):
self.data = data
self.left = None
self.right = None
# testing whether the binary tree is isomorphic or not
def isIsomorphic(x1, x2):
# Both of the roots are None and trees are isomorphic by definition
if x1 is None and x2 is None:
# one of the tree x1 and x2 is None; it is analysed that trees are not isomorphic
if x1 is None or x2 is None:
if x1.data != x2.data :
# for x1 and x2 trees to be isomorphic there are two major scenarios
# Scenario 1: subtrees that are rooted in these nodes are been “flipped”
# both of these subtrees need to be isomorphic, hence the &&
# Scenario 2: The subtrees rooted at these nodes are been "Flipped"
return ((isIsomorphic(x1.left, x2.left)and
isIsomorphic(x1.right, x2.right)) or
(isIsomorphic(x1.left, x2.right) and
# program of driver for testing the above functions
x1 = Node(1)
x1.left = Node(2)
x1.right = Node(3)
x1.left.left = Node(4)
x1.left.right = Node(5)
x1.right.left = Node(6)
x1.left.right.left = Node(7)
x1.left.right.right = Node(8)
x2 = Node(1)
x2.left = Node(3)
x2.right = Node(2)
x2.right.left = Node(4)
x2.right.right = Node(5)
x2.left.right = Node(6)
x2.right.right.left = Node(8)
x2.right.right.right = Node(7)
print "Yes" if (isIsomorphic(x1, x2) == True) else "No"
There is number of scenarios when an individual might face an issue in resolving the problem effectively and efficiently. In such cases, it is very important to compare the effectiveness of performance of resolving methods for different algorithms to select the most appropriate method for solving the required problem (Huand Wang, 2017). In order to effectively analyze the algorithm, an individual needs to consider two major factors of complexity that are, time complexity and space complexity. The time complexity of algorithm enables in quantifying the overall amount of time required by an algorithm to run any particular function of a length of the input. Similarly, the space complexity of algorithm also enables in quantifying the overall amount of memory or space, which are acquired by the algorithm to effectively run it as a function of a length of the input.
Both time and space complexity directly depends on the number of factors like operating system, hardware, processors, etc., Despite these factors, none of them is considered while analyzing the algorithm rather these are considered during execution period of algorithms.
The above solution does a traversal of both trees. So time complexity is O(x + y) where m and n are the number of nodes in given trees.
Based on the above solution for identification of isomorphic algorithm, the space complexity is determined as space or memory used by the nodes of an algorithm. Space complexity is defined specifically implemented to measure the overall amount of working storage as per required by the nodes of algorithm tree.
Graph isomorphism issue was determined in concern to computational complexity in the year 1980's. Later, the overall progress had become slow, and the overall interest of the problem was stalled. Recently, it is derived that there is numerous emergence of outcomes in concern to graph isomorphism in various research areas including algorithmic graph theory, parameterized theory, finite model theory, and combinatorial optimization.
Graph isomorphism problem is determined as the overall computational issue in identifying and determining whether the graphs of two algorithm tree are isomorphic or not. This issue of graphs is not purposely solved out within the required polynomial time, nor it is to be NP-complete. Therefore, it is also analyzed that isomorphism issue or problem of a graph is in a low hierarchy of class NP, which determines the class is not NP-complete unless and until the polynomial time hierarchy collapses on its second stage. In practice, at this time, graph isomorphism problem can be efficiently solved, and even isomorphism of similar class graphs are also solved within the provided polynomial time.
Graph problem of isomorphism is one of the special of subgraph problem of isomorphism algorithm as it questions whether the provided G graph upholds the subgraph of H, which is further considered as NP-complete. There are different concerns about problems faced in an analysis of isomorphic graph of algorithms. One of the major concern for the development of problem in testing the isomorphism of a graph of an algorithm is related to queries regarding the complexity of an algorithm. This concern is mainly derived from two isomorphism problem that is, hypergraph isomorphism problem and string isomorphism problem under the influence of the transitive group.
A graph is a tuple G = (A, B), in which A is termed as the set of vertices and B is set of overall edges within the provided graph. In the case if, G = (A1, B1)is isomorphic to H = (A2, B2)then the mapping is one to one.