total_communities, cnm_communities, modularity = cnm_find_communities( snap_graph) print('Total communities found with CNM algorithm: ', color='green', log_type='info', end='') print('{}'.format(total_communities), color='cyan', text_format='bold') if __name__ == '__main__': """ Parse arguments and follow through to mission control """ # Initial message file_operations.initial_message(os.path.basename(__file__), '(SNAP) Clauset-Newman-Moore algorithm') # Create parser parser = argparse.ArgumentParser( prog='na_cnm.py', usage='python %(prog)s <input_file> <options>', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent('''\ SNAP Clauset-Newman-Moore Algorithm '''), epilog='', add_help=True) parser.add_argument( '-i', '--input-file',
:param input_file: Input file path :param delimiter: Optional separator for he column of the input file :param weighted: Simple yes/no if the input file is weighted or not :rtype: <> """ print('Initializing.....', color='green', log_type='info') numeric_mapper(input_file, delimiter, weighted) # Standard boilerplate for running this source code file as a standalone segment if __name__ == '__main__': """ Parse arguments and follow through to mission control """ # Print initial message file_operations.initial_message(os.path.basename(__file__)) # Create parser parser = argparse.ArgumentParser(add_help=True) parser.add_argument( '-i', '--input-file', action='store', dest='input_file', required=True, help= 'Input file absolute path. E.g. /home/user/data/input/file_name.txt/.csv/.dat etc.' ) parser.add_argument( '-d',
:param delimiter: Column separator :param weighted: Is the file has a weight column? (yes/no) :param output: Boolean, yes/no if the output file will be created or not :return: <> """ print('Initializing.....', log_type='info') run_louvain(input_file, delimiter, weighted, output) # Standard boilerplate for running this source code file as a standalone segment if __name__ == '__main__': """ Parse arguments and follow through to mission control """ # Initial message file_operations.initial_message(os.path.basename(__file__), 'Louvain method') # Create parser parser = argparse.ArgumentParser( prog='na_louvain.py', usage='python %(prog)s <input_file> <options>', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent('''\ This program uses Louvain method algorithm to detect communities in large-scale networks. For more please visit: https://github.com/taynaud/python-louvain '''), epilog='', add_help=True) parser.add_argument( '-i',
:return: <> """ print('Initializing.....', color='green', log_type='info') # Clip text according to input clip_text(input_file, delimiter, start_date, interval) pass # Standard boilerplate for running this source code file as a standalone segment if __name__ == '__main__': """ Parse arguments and follow through to mission control """ # Print initial message message = 'This script uses linux timestamps. Input file format (source target weight timestamp)' file_operations.initial_message(os.path.basename(__file__), custom_message=message) # Create parser parser = argparse.ArgumentParser(add_help=True) parser.add_argument( '-i', '--input-file', action='store', dest='input_file', required=True, help= 'Input file absolute path. E.g. /home/user/data/input/file_name.txt') parser.add_argument( '-d', '--delimiter',
:param weighted: are the edges weighted? :param trials: number of trials/run to find out community :param output: whether output file will be created or not (boolean - yes/no) :return: NULL """ print('Initializing.....', log_type='info') run_infomap(input_file, delimiter, weighted, trials, output) # Standard boilerplate for running this source code file as a standalone segment if __name__ == '__main__': """ Parse arguments and follow through to mission control """ # Initial message file_operations.initial_message(os.path.basename(__file__), 'Infomap') # Create parser parser = argparse.ArgumentParser(prog='na_infomap.py', usage='python %(prog)s <input_file> <options>', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent('''\ This program uses Infomap algorithm to detect communities in large-scale networks. For more please visit: http://www.mapequation.org To find out available <options> for this program please visit: http://www.mapequation.org/code.html#Options '''), epilog='', add_help=True) parser.add_argument('-i', '--input-file', action='store', dest='input', required=True,