Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions netstruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ def FindCommunities(fname,threshold=0.0,algorithm_num=6):
6 : leading.eigenvector.community -> returns VertexClustering object.
"""
area,ind,GDmatrix=loadGDmatrix(fname)
matx=stats.threshold(GDmatrix, threshmin=threshold,newval=0) # Creates an adjacency matrix with a threshold applied to GDmatrix (i.e. all values below the threshold are taken to be 0)
# matx=stats.threshold(GDmatrix, threshmin=threshold,newval=0) # Creates an adjacency matrix with a threshold applied to GDmatrix (i.e. all values below the threshold are taken to be 0)
matx = GDmatrix
matx[matx<threshold] = 0

graph = igraph.Graph.Weighted_Adjacency(matx.tolist(),attr="weight",mode="UPPER")#Creates an undirected weighted igraph graph object with the adjacency matrix
graph["name"] = "NetStruck Weighted Graph with threshold={0}".format(threshold)
graph.vs["area"]=area
Expand Down Expand Up @@ -494,4 +497,4 @@ def add_parser_arguments(parser):
parser = ArgumentParser(prog='PROG', usage='%(prog)s [options]')
parser = add_parser_arguments(parser)
args = parser.parse_args()
main(args)
main(args)