Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
e01fe793
Commit
e01fe793
authored
Dec 18, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edges updated following the new schema
parent
ac239825
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+12
-7
No files found.
dream/simulation/LineGenerationJSON.py
View file @
e01fe793
...
@@ -85,11 +85,16 @@ def createObjectResourcesAndCoreObjects():
...
@@ -85,11 +85,16 @@ def createObjectResourcesAndCoreObjects():
list of object with ID = id
list of object with ID = id
XXX slow implementation
XXX slow implementation
'''
'''
def
getSuccessorList
(
node_id
,
predicate
=
lambda
source
,
destination
,
edge_data
:
True
):
def
getSuccessorList
(
node_id
,
predicate
=
lambda
source
,
destination
,
edge_
class
,
edge_
data
:
True
):
successor_list
=
[]
# dummy variable that holds the list to be returned
successor_list
=
[]
# dummy variable that holds the list to be returned
for
source
,
destination
,
edge_data
in
edges
.
values
():
# for all the values in the dictionary edges
for
edge
in
edges
.
values
():
source
=
edge
[
"source"
]
destination
=
edge
[
"destination"
]
edge_class
=
edge
[
"_class"
]
edge_data
=
edge
.
get
(
"data"
,
{})
if
source
==
node_id
:
# for the node_id argument
if
source
==
node_id
:
# for the node_id argument
if
predicate
(
source
,
destination
,
edge_data
):
# find its 'destinations' and
if
predicate
(
source
,
destination
,
edge_class
,
edge_data
):
# find its 'destinations' and
successor_list
.
append
(
destination
)
# append it to the successor list
successor_list
.
append
(
destination
)
# append it to the successor list
# XXX We should probably not need to sort, but there is a bug that
# XXX We should probably not need to sort, but there is a bug that
# prevents Topology10 to work if this sort is not used.
# prevents Topology10 to work if this sort is not used.
...
@@ -215,9 +220,9 @@ def createObjectResourcesAndCoreObjects():
...
@@ -215,9 +220,9 @@ def createObjectResourcesAndCoreObjects():
coreObject
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
coreObject
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
# (Below is only for Dismantle for now)
# (Below is only for Dismantle for now)
# get the successorList for the 'Parts'
# get the successorList for the 'Parts'
coreObject
.
nextPartIds
=
getSuccessorList
(
element
[
'id'
],
lambda
source
,
destination
,
edge_
data
:
edge_data
.
get
(
'entity'
)
==
'Part'
)
coreObject
.
nextPartIds
=
getSuccessorList
(
element
[
'id'
],
lambda
source
,
destination
,
edge_
class
,
edge_data
:
edge_data
.
get
(
'entity'
,{}
)
==
'Part'
)
# get the successorList for the 'Frames'
# get the successorList for the 'Frames'
coreObject
.
nextFrameIds
=
getSuccessorList
(
element
[
'id'
],
lambda
source
,
destination
,
edge_
data
:
edge_data
.
get
(
'entity'
)
==
'Frame'
)
coreObject
.
nextFrameIds
=
getSuccessorList
(
element
[
'id'
],
lambda
source
,
destination
,
edge_
class
,
edge_data
:
edge_data
.
get
(
'entity'
,{}
)
==
'Frame'
)
# loop through all the core objects
# loop through all the core objects
# to read predecessors
# to read predecessors
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment