Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Detection eddies
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
IPSL
LMD
DPAO
Detection eddies
Commits
754ade37
Commit
754ade37
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Do not make trajectory an internal property
No need for this property to be internal.
parent
5633dea0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
trajectories.py
+10
-10
10 additions, 10 deletions
trajectories.py
with
10 additions
and
10 deletions
trajectories.py
+
10
−
10
View file @
754ade37
...
...
@@ -3,7 +3,7 @@
"""
A script that loads a segmented cf graph in the gt format, iterates
on all of the edges and cost functions and generates the trajectories
as done in MATLAB. Segments (nodes) have a new vertex property called
"
traj
"
that holds the trajectory ID that that segment belongs to. The
"
traj
_prop
"
that holds the trajectory ID that that segment belongs to. The
output is either an expanded JSON file and/or an edgelist file with
all of the trajectories.
...
...
@@ -26,17 +26,17 @@ class Visitor(search.BFSVisitor):
self
.
trajectories
=
{}
def
discover_vertex
(
self
,
u
):
if
g
.
vp
.
traj
[
u
]
not
in
self
.
trajectories
:
self
.
trajectories
[
g
.
vp
.
traj
[
u
]]
=
[
g
.
vp
.
name
[
u
]]
if
traj_prop
[
u
]
not
in
self
.
trajectories
:
self
.
trajectories
[
traj_prop
[
u
]]
=
[
g
.
vp
.
name
[
u
]]
else
:
self
.
trajectories
[
g
.
vp
.
traj
[
u
]].
append
(
g
.
vp
.
name
[
u
])
self
.
trajectories
[
traj_prop
[
u
]].
append
(
g
.
vp
.
name
[
u
])
g
=
graph_tool
.
load_graph
(
sys
.
argv
[
1
])
g
.
vp
[
'
traj
'
]
=
g
.
new_vp
(
'
int
'
)
traj_prop
=
g
.
new_vp
(
'
int
'
)
# Assign the new vertex property:
for
node
in
g
.
vertices
():
g
.
vp
.
traj
[
node
]
=
g
.
vp
.
name
[
node
]
traj_prop
[
node
]
=
g
.
vp
.
name
[
node
]
print
(
'
Setting trajectory vertex property...
'
)
...
...
@@ -52,17 +52,17 @@ for edge in g.edges():
if
current_cf
<=
min
({
g
.
ep
.
cost_function
[
e
]
for
e
in
trg
.
out_edges
()}):
# Set trg trajectory to src trajectory
g
.
vp
.
traj
[
trg
]
=
g
.
vp
.
traj
[
src
]
traj_prop
[
trg
]
=
traj_prop
[
src
]
else
:
g
.
vp
.
traj
[
trg
]
=
g
.
vp
.
traj
[
src
]
traj_prop
[
trg
]
=
traj_prop
[
src
]
else
:
# src.out_degree() == 1
if
trg
.
in_degree
()
>
1
:
if
current_cf
<=
min
({
g
.
ep
.
cost_function
[
e
]
for
e
in
trg
.
in_edges
()}):
g
.
vp
.
traj
[
trg
]
=
g
.
vp
.
traj
[
src
]
traj_prop
[
trg
]
=
traj_prop
[
src
]
else
:
g
.
vp
.
traj
[
trg
]
=
g
.
vp
.
traj
[
src
]
traj_prop
[
trg
]
=
traj_prop
[
src
]
print
(
'
Creating the dictionary of trajectories...
'
)
visitor
=
Visitor
()
...
...
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