# 独立路径计算

【问题描述】

【输入形式】

<n> <e>

<e1> <vi1> <vj1>

<e2> <vi2> <vj2>

&hellip;

<en> <vin> <vjn>

【输出形式】

【样例输入】

6 8

1 0 1

2 1 2

3 2 3

4 2 4

5 3 5

6 4 5

7 0 5

8 0 1

【样例输出】

1 2 3 5

1 2 4 6

7

8 2 3 5

8 2 4 6

【样例说明】

#include <stdio.h>
#include <string.h>

typedef struct _Edge
{
int seq;
struct _Edge *next;
} Edge;

typedef struct _Vertex
{
int seq;
} Vertex;

{
int size;
Vertex *list;

{
int i;

for (i = 0; i < n; i++)
{
}
}

void insert_Edge(int seq, Vertex *head, int end)
{
Edge *newEdge = (Edge *)malloc(sizeof(Edge));

newEdge->seq = seq;
newEdge->next = NULL;
if (rear == NULL)
{
}
else
{
while (rear->next != NULL) rear = rear->next; // reach the rear
rear->next = newEdge;						// add the new Edge at the rear
}
}

void print_Path(int path[])
{
int i = 0;
while (path[i + 1] != 0)
printf("%d ", path[i++]);
printf("%d\n", path[i]);
}

{
if (start == adjlist.size - 1)
{
path[depth] = 0; // mark the end of the path
print_Path(path);
return;
}
else
{
if (!visited[start]) // no loop in a path, thus no vertex should be visited twice
{
visited[start] = 1; // if not visited before, now mark it as visited
{
path[depth] = link->seq; // mark the edge as a step in the path
}
visited[start] = 0; // de-visit this vertex so that after quitting other searching can reach this vertex again
return;
}
}
}

{
int *path = (int *)malloc(adjlist.size*sizeof(int)); // a path cannot be longer than the number of vertexes
memset(visited, 0, adjlist.size*sizeof(int));  // mark all vertexes as unvisited
free(path);
free(visited);
}

int main()
{
int n, e;
int seq,v1,v2,i;

scanf("%d %d",&n, &e);
}