simple C++ code to check if a graph is Palindorm or not
Budget: €8 – €30 EUR
You are going to find a solution to check a graph and print out a string like “Yes” or “No”. This solution must be on C++ code that has an input as a graph. The solution print:
A. “Yes”: if the input is a Palindorm graph
B. “No”: if the input is not a Palindorm graph
I need a documented clear code/program that is easy to read and understand (junior level). the code must be compiled and run successfully and print correct output. An explanation meeting is needed ( about the parameters, function and method).
More details:
NB: G is a Palindorm graph with the following conditions:
Consider a tree (a graph that starts by a root and ends by leaf/leaves) and call it “T”.
Copy T to a new tree name it “S”
Create G graph that is a combination of S and T by the following condition:
Merge symmetric leaves together if and only if they are not any kind of root, neither parent of others’ nodes (only the littlest children/leaves can be merged).
Input:
The input is a graph. We define it over a matrix. The Matrix has (M+1) rows and 2 columns. In the other word, input has M+ 1 lines which includes 2 sections:
In the first line/row, there are 2 numbers:
First number: n is the indicates the number of nodes
Second number: m indicates the number of links between 2 nodes
All Graph’s nodes were numbered within 1 to n
In the next m lines, a link between 2 nodes is determined. On each line there is one x and y which means
there is a link between x and y. (1≤x,y≤n ,x≠y)
Rules:
1- There is just one link between each 2 nodes.
2- 3≤n,m≤10000
3- x and y are just a name/label of each node.
for more information, please look at the attachment.
A. “Yes”: if the input is a Palindorm graph
B. “No”: if the input is not a Palindorm graph
I need a documented clear code/program that is easy to read and understand (junior level). the code must be compiled and run successfully and print correct output. An explanation meeting is needed ( about the parameters, function and method).
More details:
NB: G is a Palindorm graph with the following conditions:
Consider a tree (a graph that starts by a root and ends by leaf/leaves) and call it “T”.
Copy T to a new tree name it “S”
Create G graph that is a combination of S and T by the following condition:
Merge symmetric leaves together if and only if they are not any kind of root, neither parent of others’ nodes (only the littlest children/leaves can be merged).
Input:
The input is a graph. We define it over a matrix. The Matrix has (M+1) rows and 2 columns. In the other word, input has M+ 1 lines which includes 2 sections:
In the first line/row, there are 2 numbers:
First number: n is the indicates the number of nodes
Second number: m indicates the number of links between 2 nodes
All Graph’s nodes were numbered within 1 to n
In the next m lines, a link between 2 nodes is determined. On each line there is one x and y which means
there is a link between x and y. (1≤x,y≤n ,x≠y)
Rules:
1- There is just one link between each 2 nodes.
2- 3≤n,m≤10000
3- x and y are just a name/label of each node.
for more information, please look at the attachment.