<commit_before>﻿// Copyright 2017 -- <NAME>, OSIsoft, LLC
// Licensed under the MIT license
//
// MathNet Numerics nuget used in SLPA copyright:
///Copyright(c) 2002-2015 Math.NET

///Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:



/// Algorithms for community detection in networks
/// Alogorithms are Speaker-Listener Propagation Alogirthm, Connected Iterative Scan (CIS), and Louvain.

using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics;
using MathNet.Numerics.Distributions;
using Networks.Core;

namespace Networks.Algorithms
{
    public partial class CommunityDetection
    {
        #region CIS
        // ported from http://www.cs.rpi.edu/~magdon/LFDlabpublic.html/software/CIS/CIS.tar.gz
        // based on "Finding Overlapping Communities in Social Networks", Goldberg, Kelley, Magdon-Ismail, Mertsalov, Wallace, 2010
        // Takes a seed community (may be a single vertex) and expands it by neighboring vertices if doing so improves the community metric
        public static void CISExpandSeed(ref HashSet<string> seed, Network G, double lambda)
        {
            HashSet<string> fringe = new HashSet<string>();
            Dictionary<string, Tuple<float, float>> members = new Dictionary<string, Tuple<float, float>>();
            Dictionary<string, Tuple<float, float>> neighbors = new Dictionary<string, Tuple<float, float>>();
            float seedWeightIn = 0;
            float seedWeightOut = 0;

            foreach(string node in seed)
            {  
                //Add members of the seed, calculating individual
               // Win and Wout measures and noting neighborhood<commit_msg>Typo fixed<commit_after>﻿// Copyright 2017 -- <NAME>, OSIsoft, LLC
// Licensed under the MIT license
//
// MathNet Numerics nuget used in SLPA copyright:
///Copyright(c) 2002-2015 Math.NET

///Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:



/// Algorithms for community detection in networks
/// Alogorithms are Speaker-Listener Propagation Alogrithm, Connected Iterative Scan (CIS), and Louvain.

using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics;
using MathNet.Numerics.Distributions;
using Networks.Core;

namespace Networks.Algorithms
{
    public partial class CommunityDetection
    {
        #region CIS
        // ported from http://www.cs.rpi.edu/~magdon/LFDlabpublic.html/software/CIS/CIS.tar.gz
        // based on "Finding Overlapping Communities in Social Networks", Goldberg, Kelley, Magdon-Ismail, Mertsalov, Wallace, 2010
        // Takes a seed community (may be a single vertex) and expands it by neighboring vertices if doing so improves the community metric
        public static void CISExpandSeed(ref HashSet<string> seed, Network G, double lambda)
        {
            HashSet<string> fringe = new HashSet<string>();
            Dictionary<string, Tuple<float, float>> members = new Dictionary<string, Tuple<float, float>>();
            Dictionary<string, Tuple<float, float>> neighbors = new Dictionary<string, Tuple<float, float>>();
            float seedWeightIn = 0;
            float seedWeightOut = 0;

            foreach(string node in seed)
            {  
                //Add members of the seed, calculating individual
               // Win and Wout measures and noting neighborhood
{'fraction_non_alphanumeric': 0.08193123628383321, 'fraction_numerical': 0.008778346744696415, 'mean_word_length': 3.3178947368421055, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '499160', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1021, 'n_words': 434}