Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Enchente
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vytor Calixto
Enchente
Commits
1fc18936
Commit
1fc18936
authored
8 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Patches
Plain Diff
Add funções para destruir grafo e vértices
parent
9805ceaf
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
libs/grafo.c
+5
-3
5 additions, 3 deletions
libs/grafo.c
libs/grafo.h
+1
-1
1 addition, 1 deletion
libs/grafo.h
libs/vertice.c
+10
-0
10 additions, 0 deletions
libs/vertice.c
libs/vertice.h
+2
-0
2 additions, 0 deletions
libs/vertice.h
with
18 additions
and
4 deletions
libs/grafo.c
+
5
−
3
View file @
1fc18936
...
...
@@ -111,7 +111,9 @@ void tabuleiroParaGrafo(Tblr t, Grafo g) {
return
;
}
int
*
buscaCaminho
(
Grafo
g
)
{
int
*
caminho
=
malloc
(
sizeof
(
int
));
return
caminho
;
void
destroiGrafo
(
Grafo
g
)
{
destroiLista
(
g
->
vertices
,
destroiVertice
);
free
(
g
);
g
=
NULL
;
return
;
}
This diff is collapsed.
Click to expand it.
libs/grafo.h
+
1
−
1
View file @
1fc18936
...
...
@@ -16,6 +16,6 @@ void criaArco(Vertice v, Vertice w);
void
tabuleiroParaGrafo
(
Tblr
t
,
Grafo
g
);
int
*
buscaCaminh
o
(
Grafo
g
);
void
destroiGraf
o
(
Grafo
g
);
#endif
This diff is collapsed.
Click to expand it.
libs/vertice.c
+
10
−
0
View file @
1fc18936
...
...
@@ -11,3 +11,13 @@ Vertice criaVertice() {
v
->
filhos
=
constroiLista
();
return
v
;
}
int
destroiVertice
(
void
*
v
)
{
Vertice
w
=
(
Vertice
)
v
;
// Como os outros vértices também estão no grafo, deixamos isso a cargo dele
destroiLista
(
w
->
pais
,
NULL
);
destroiLista
(
w
->
filhos
,
NULL
);
free
(
w
);
w
=
NULL
;
return
1
;
}
This diff is collapsed.
Click to expand it.
libs/vertice.h
+
2
−
0
View file @
1fc18936
...
...
@@ -13,4 +13,6 @@ typedef struct Vertice *Vertice;
Vertice
criaVertice
();
int
destroiVertice
(
void
*
v
);
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment