Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define TOT_VERT 5
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct node Node;
- typedef struct graph Graph;
- typedef struct edge Edge;
- struct node {
- Edge* final_aresta;
- Node* prox;
- };
- struct graph {
- Node* vetor[TOT_VERT];
- };
- struct edge {
- int vert_arest_inicial;
- int vert_arest_final;
- };
- Graph** criaGraph(Graph* p, int qtd) {
- p = NULL;
- for (int i = 0; i < qtd; i++) {
- p[i] ;
- }
- }
- int verifica(Graph * p, int ini, int fim ){
- if (p->vetor[] <= fim ) {
- return 0 ;
- }
- return 1;
- }
- Node* criaLista() {
- Node* lst;
- lst = NULL;
- return lst;
- }
- Node* insere(Node* lst, int id) {
- Node* p;
- p = (Node*)malloc(sizeof(Node));
- if (p == NULL) return NULL;
- p->ponta_final_aresta->vert_arest_final = id;
- p->prox = lst;
- return p;
- }
- void lista_exibe(Graph** g) {
- for (int i; g[i] != NULL; i++) {
- for (g[i] = ponta_final_aresta; ponta_final_aresta != NULL; Edge * g[i] = g[i]) {}
- printf("(%d -> %d) ", g[i].ponta_final_aresta->vert_arest_inicial , g[i].node->ponta_final_aresta->vert_arest_final);
- }
- }
- int main() {
- Graph* v[] = { 0, 1 ,2 ,3 ,4, 5 };
- Node* lst;
- lst = criaLista();
- Edge edges1[] ={ {0,1}, {1,2}, {2,0}, {2,1}, {3,1}, {4,2} };
- lst = criaLista();
- lst = insere(lst, 1);
- lst = insere(lst, 3);
- lst = insere(lst, 5);
- lst = insere(lst, 7);
- lista_exibe(lst);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement