/* Find euler path or circle function
* g[][] is the bi-directional graph
* 0->6 are all the node
* stack[] store the nodes in the path
* adjacent nodes in stack[] form an edge
* Function Call: euler(startNode x)
*/
void euler(int x)
{
for(int i=0;i<=6;i++)
if(g[x][i]) // or "while(g[x][i])" both accepted
{
g[x][i]--; g[i][x]--;
euler(i);
}
stack[++top]=x;
} |
/* Find euler path or circle function
* g[][] is the bi-directional graph
* 0->6 are all the node
* stack[] store the nodes in the path
* adjacent nodes in stack[] form an edge
* Function Call: euler(startNode x)
*/
void euler(int x)
{
for(int i=0;i<=6;i++)
if(g[x][i]) // or "while(g[x][i])" both accepted
{
g[x][i]--; g[i][x]--;
euler(i);
}
stack[++top]=x;
}