Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algoritmer og datastrukturer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Jacob Theisen
Algoritmer og datastrukturer
Commits
24acbb88
Commit
24acbb88
authored
3 years ago
by
Jacob Theisen
Browse files
Options
Downloads
Patches
Plain Diff
kjordaibakke
parent
49f597b2
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ov9/program1.py
+45
-4
45 additions, 4 deletions
ov9/program1.py
ov9/test_files/interessepkt.txt
+1
-1
1 addition, 1 deletion
ov9/test_files/interessepkt.txt
with
46 additions
and
5 deletions
ov9/program1.py
+
45
−
4
View file @
24acbb88
class
int_points
(
object
):
class
int_points
(
object
):
def
__init__
(
self
,
id
,
type
,
name
):
def
__init__
(
self
,
id
,
type
,
name
):
self
.
id
=
id
self
.
id
=
id
...
@@ -9,7 +7,8 @@ class int_points (object):
...
@@ -9,7 +7,8 @@ class int_points (object):
self
.
name
=
name
self
.
name
=
name
class
nodes
(
object
):
class
nodes
(
object
):
def
__init__
(
self
,
bredde
,
lengde
):
def
__init__
(
self
,
node
,
bredde
,
lengde
):
self
.
node
=
node
self
.
bredde
=
bredde
self
.
bredde
=
bredde
self
.
lengde
=
lengde
self
.
lengde
=
lengde
...
@@ -20,3 +19,45 @@ class edges (object):
...
@@ -20,3 +19,45 @@ class edges (object):
self
.
time
=
time
self
.
time
=
time
self
.
lenght
=
lenght
self
.
lenght
=
lenght
self
.
speed
=
speed
self
.
speed
=
speed
with
open
(
'
./test_files/noder.txt
'
,
'
r
'
)
as
file
:
node_file
=
file
.
read
()
node_file
=
node_file
.
split
()
num_of_nodes
=
node_file
[
0
]
node_file
.
pop
(
0
)
node_arr
=
[]
for
i
in
range
(
0
,
len
(
node_file
),
3
):
#nodenr breddegrad lengdegrad
node_arr
.
append
(
nodes
(
node_file
[
i
],
node_file
[
i
+
1
],
node_file
[
i
+
2
]))
with
open
(
'
./test_files/kanter.txt
'
,
'
r
'
)
as
file
:
edge_file
=
file
.
read
()
edge_file
=
edge_file
.
split
()
num_of_edges
=
edge_file
[
0
]
edge_file
.
pop
(
0
)
edge_arr
=
[]
for
i
in
range
(
0
,
len
(
edge_file
),
5
):
#franode tilnode kjøretid lengde fartsgrense
edge_arr
.
append
(
edges
(
edge_file
[
i
],
edge_file
[
i
+
1
],
edge_file
[
i
+
2
],
edge_file
[
i
+
3
],
edge_file
[
i
+
4
]))
with
open
(
'
./test_files/interessepkt.txt
'
,
'
r
'
)
as
file
:
intresting_file
=
file
.
read
()
intresting_file
=
intresting_file
.
split
(
'
\n
'
)
num_of_intresting
=
intresting_file
[
0
]
intresting_file
.
pop
(
0
)
intresting_arr
=
[]
for
i
in
range
(
len
(
intresting_file
)):
#nodenr kode "Navn på stedet"
tmp_values
=
intresting_file
[
i
].
split
()
intresting_arr
.
append
(
int_points
(
tmp_values
[
0
],
tmp_values
[
1
],
'
'
.
join
(
tmp_values
[
2
:])))
This diff is collapsed.
Click to expand it.
ov9/test_files/interessepkt.txt
+
1
−
1
View file @
24acbb88
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