コード例 #1
0
def drawCommunityGraph(G, zeta, **kwargs):
	""" Draws the community graph of a given graph and partition. Takes the same optional parameters as networkx.draw(...) except node_size."""
	cg = ParallelPartitionCoarsening() 
	graph,_ = cg.run(G,zeta) # convert communities to nodes
	comGraph = nxadapter.nk2nx(graph)
	kwargs["node_size"] = [size*2 for size in list(zeta.subsetSizeMap().values())]
	networkx.draw(comGraph, **kwargs)
コード例 #2
0
def drawCommunityGraph(G, zeta, **kwargs):
    """ Draws the community graph of a given graph and partition. Takes the same optional parameters as networkx.draw(...) except node_size."""
    cg = ParallelPartitionCoarsening()
    graph, _ = cg.run(G, zeta)  # convert communities to nodes
    comGraph = nxadapter.nk2nx(graph)
    kwargs["node_size"] = [
        size * 2 for size in list(zeta.subsetSizeMap().values())
    ]
    networkx.draw(comGraph, **kwargs)
コード例 #3
0
ファイル: viztasks.py プロジェクト: tsapko3628/networkit
def drawCommunityGraph(G, zeta, **kwargs):
    """ Draws the community graph for a given graph and partition. Passes any additional arguments to networkx.draw(...).
	    By default, node sizes are scaled between 30 and 500 by community size.
	"""
    cg = ParallelPartitionCoarsening(G, zeta)
    cg.run()  # convert communities to nodes
    graph = cg.getCoarseGraph()
    comGraph = nxadapter.nk2nx(graph)
    if not "node_size" in kwargs:
        sizes = list(zeta.subsetSizeMap().values())
        max_size = max(sizes)
        sizes = [elem / max_size for elem in sizes]
        kwargs["node_size"] = [30 + 470 * s for s in sizes]
    networkx.draw(comGraph, **kwargs)
コード例 #4
0
ファイル: community.py プロジェクト: beredentod/bnetworkit
def communityGraph(G, zeta):
	""" Create a community graph, i.e. a graph in which one node represents a community and an edge represents the edges between communities, from a given graph and a community detection solution"""
	cg = ParallelPartitionCoarsening(G, zeta)
	cg.run()
	return cg.getCoarseGraph()
コード例 #5
0
def communityGraph(G, zeta):
	""" Create a community graph, i.e. a graph in which one node represents a community and an edge represents the edges between communities, from a given graph and a community detection solution"""
	cg = ParallelPartitionCoarsening(G, zeta)
	cg.run()
	return cg.getCoarseGraph()