Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pydtnsim
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
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
discus
pydtnsim
Commits
abb283d3
Commit
abb283d3
authored
7 years ago
by
Jarrod Pas
Browse files
Options
Downloads
Patches
Plain Diff
kids.cache is actually slower than recomputing
parent
77054993
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!3
Version 0.2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pydtn/communities/base.py
+0
-7
0 additions, 7 deletions
pydtn/communities/base.py
with
0 additions
and
7 deletions
pydtn/communities/base.py
+
0
−
7
View file @
abb283d3
from
itertools
import
product
from
itertools
import
product
import
networkx
as
nx
import
networkx
as
nx
from
kids.cache
import
cache
from
pydtn.core
import
TickProcess
from
pydtn.core
import
TickProcess
...
@@ -62,7 +61,6 @@ class EpochCommunity(TickProcess):
...
@@ -62,7 +61,6 @@ class EpochCommunity(TickProcess):
self
.
get_ncf
.
cache_clear
()
self
.
get_ncf
.
cache_clear
()
self
.
get_cbc
.
cache_clear
()
self
.
get_cbc
.
cache_clear
()
@cache
def
get_ld
(
self
,
x
):
def
get_ld
(
self
,
x
):
''''''
''''''
g
=
self
.
old_graph
g
=
self
.
old_graph
...
@@ -75,12 +73,10 @@ class EpochCommunity(TickProcess):
...
@@ -75,12 +73,10 @@ class EpochCommunity(TickProcess):
if
y
in
g
[
x
]
and
g
[
x
][
y
][
'
duration
'
]
>
0
if
y
in
g
[
x
]
and
g
[
x
][
y
][
'
duration
'
]
>
0
]
]
@cache
def
get_lp
(
self
,
x
):
def
get_lp
(
self
,
x
):
'''
local popularity of a node
'''
'''
local popularity of a node
'''
return
sum
(
self
.
get_ld
(
x
))
return
sum
(
self
.
get_ld
(
x
))
@cache
def
get_gp
(
self
,
node
):
def
get_gp
(
self
,
node
):
'''
global popularity of a node
'''
'''
global popularity of a node
'''
if
node
not
in
self
.
old_graph
:
if
node
not
in
self
.
old_graph
:
...
@@ -93,12 +89,10 @@ class EpochCommunity(TickProcess):
...
@@ -93,12 +89,10 @@ class EpochCommunity(TickProcess):
if
other
not
in
community
if
other
not
in
community
])
])
@cache
def
get_ui
(
self
,
x
):
def
get_ui
(
self
,
x
):
'''
unique interactions with a node
'''
'''
unique interactions with a node
'''
return
len
(
self
.
get_ld
(
x
))
return
len
(
self
.
get_ld
(
x
))
@cache
def
get_cbc
(
self
,
c_x
,
c_y
):
def
get_cbc
(
self
,
c_x
,
c_y
):
''''''
''''''
if
c_x
==
c_y
:
if
c_x
==
c_y
:
...
@@ -110,7 +104,6 @@ class EpochCommunity(TickProcess):
...
@@ -110,7 +104,6 @@ class EpochCommunity(TickProcess):
if
x
in
g
and
y
in
g
[
x
]
if
x
in
g
and
y
in
g
[
x
]
])
])
@cache
def
get_ncf
(
self
,
x
,
c_y
):
def
get_ncf
(
self
,
x
,
c_y
):
''''''
''''''
g
=
self
.
old_graph
g
=
self
.
old_graph
...
...
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