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
5865b354
Commit
5865b354
authored
7 years ago
by
Jarrod Pas
Browse files
Options
Downloads
Patches
Plain Diff
Forgot to self env
parent
e474611e
No related branches found
No related tags found
1 merge request
!3
Version 0.2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pydyton/communities/kclique.py
+3
-1
3 additions, 1 deletion
pydyton/communities/kclique.py
pydyton/communities/louvain.py
+3
-1
3 additions, 1 deletion
pydyton/communities/louvain.py
with
6 additions
and
2 deletions
pydyton/communities/kclique.py
+
3
−
1
View file @
5865b354
...
@@ -2,6 +2,8 @@ import networkx as nx
...
@@ -2,6 +2,8 @@ import networkx as nx
from
.base
import
EpochCommunity
from
.base
import
EpochCommunity
# TODO: this is probably bugged, performs terribly for bubble
class
KCliqueCommunity
(
EpochCommunity
):
class
KCliqueCommunity
(
EpochCommunity
):
def
__init__
(
self
,
k
=
3
,
threshold
=
300
,
epoch
=
604800
,
**
kwargs
):
def
__init__
(
self
,
k
=
3
,
threshold
=
300
,
epoch
=
604800
,
**
kwargs
):
super
().
__init__
(
epoch
,
**
kwargs
)
super
().
__init__
(
epoch
,
**
kwargs
)
...
@@ -11,7 +13,7 @@ class KCliqueCommunity(EpochCommunity):
...
@@ -11,7 +13,7 @@ class KCliqueCommunity(EpochCommunity):
def
process
(
self
,
network
):
def
process
(
self
,
network
):
while
True
:
while
True
:
yield
self
.
tick
()
yield
self
.
tick
()
g
=
self
.
next_epoch
(
env
.
now
)
g
=
self
.
next_epoch
(
self
.
env
.
now
)
G
=
nx
.
Graph
()
G
=
nx
.
Graph
()
G
.
add_nodes_from
(
g
.
nodes
())
G
.
add_nodes_from
(
g
.
nodes
())
...
...
This diff is collapsed.
Click to expand it.
pydyton/communities/louvain.py
+
3
−
1
View file @
5865b354
from
collections
import
defaultdict
from
community
import
best_partition
as
louvain_partition
from
community
import
best_partition
as
louvain_partition
from
.base
import
EpochCommunity
from
.base
import
EpochCommunity
...
@@ -11,7 +13,7 @@ class LouvainCommunity(EpochCommunity):
...
@@ -11,7 +13,7 @@ class LouvainCommunity(EpochCommunity):
def
process
(
self
,
network
):
def
process
(
self
,
network
):
while
True
:
while
True
:
yield
self
.
tick
()
yield
self
.
tick
()
g
=
self
.
next_epoch
(
env
.
now
)
g
=
self
.
next_epoch
(
self
.
env
.
now
)
p
=
louvain_partition
(
g
,
weight
=
'
duration
'
)
p
=
louvain_partition
(
g
,
weight
=
'
duration
'
)
communities
=
defaultdict
(
set
)
communities
=
defaultdict
(
set
)
...
...
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