Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
55bee9c1
Commit
55bee9c1
authored
Aug 17, 2009
by
Tiago Peixoto
Browse files
Rename community_network() to condensation_graph()
parent
db7589d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/community/__init__.py
View file @
55bee9c1
...
...
@@ -30,7 +30,7 @@ dl_import("import libgraph_tool_community")
from
..
core
import
_degree
,
_prop
,
Graph
,
libcore
import
random
,
sys
__all__
=
[
"community_structure"
,
"modularity"
,
"co
mmunity_network
"
]
__all__
=
[
"community_structure"
,
"modularity"
,
"co
ndensation_graph
"
]
def
community_structure
(
g
,
n_iter
,
n_spins
,
gamma
=
1.0
,
corr
=
"erdos"
,
...
...
@@ -74,7 +74,7 @@ def community_structure(g, n_iter, n_spins, gamma=1.0, corr= "erdos",
--------
community_structure: obtain the community structure
modularity: calculate the network modularity
co
mmunity_network
: network of communities
co
ndensation_graph
: network of communities
Notes
-----
...
...
@@ -228,7 +228,7 @@ def modularity(g, prop, weight=None):
--------
community_structure: obtain the community structure
modularity: calculate the network modularity
co
mmunity_network
: network of communities
co
ndensation_graph
: network of communities
Notes
-----
...
...
@@ -267,9 +267,10 @@ def modularity(g, prop, weight=None):
_prop
(
"v"
,
g
,
prop
))
return
m
def
co
mmunity_network
(
g
,
prop
,
weight
=
None
):
def
co
ndensation_graph
(
g
,
prop
,
weight
=
None
):
r
"""
Obtain the network of communities.
Obtain the condensation graph, where each vertex with the same 'prop' value
is condensed in one vertex.
Parameters
----------
...
...
@@ -282,7 +283,7 @@ def community_network(g, prop, weight=None):
Returns
-------
co
mmunity_network
: Graph
co
ndensation_graph
: Graph
The community network
vcount : PropertyMap
A vertex property map with the vertex count for each community.
...
...
@@ -293,13 +294,14 @@ def community_network(g, prop, weight=None):
--------
community_structure: obtain the community structure
modularity: calculate the network modularity
co
mmunity_network:
network of communities
co
ndensation_graph:
network of communities
Notes
-----
Each vertex in the community network represents one community in the
original graph, and the edges represent existent edges between vertices of
the respective communities in the original graph.
Each vertex in the condensation graph represents one community in the
original graph (vertices with the same 'prop' value'), and the edges
represent existent edges between vertices of the respective communities in
the original graph.
Examples
--------
...
...
@@ -308,7 +310,7 @@ def community_network(g, prop, weight=None):
>>> seed(42)
>>> g = gt.random_graph(1000, lambda: poisson(3), directed=False)
>>> spins = gt.community_structure(g, 10000, 100)
>>> ng = gt.co
mmunity_network
(g, spins)
>>> ng = gt.co
ndensation_graph
(g, spins)
>>> size = ng[0].new_vertex_property("double")
>>> size.get_array()[:] = log(ng[1].get_array()+1)
>>> gt.graph_draw(ng[0], vsize=size, vcolor=size, splines=True,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment